e2k: Add psign{b,h,w} instrs.

This commit is contained in:
Denis Drakhnia 2021-01-16 16:19:56 +02:00 committed by Denis Drakhnia
parent 780ccf14ab
commit 9440e28b68
3 changed files with 18 additions and 3 deletions

View File

@ -96,6 +96,11 @@ DEF_HELPER_2(pmullh, i64, i64, i64)
DEF_HELPER_2(pmulhuh, i64, i64, i64)
DEF_HELPER_2(pmulubhh, i64, i64, i64)
/* Packed Sign Mul */
DEF_HELPER_2(psignb, i64, i64, i64)
DEF_HELPER_2(psignh, i64, i64, i64)
DEF_HELPER_2(psignw, i64, i64, i64)
/* Packed Move Mask */
DEF_HELPER_2(pmovmskb, i64, i64, i64)
DEF_HELPER_2(pmovmskps, i64, i64, i64)

View File

@ -63,6 +63,10 @@ typedef union {
}
#define GEN_HELPER_PACKED(name, type, code) \
GEN_HELPER_PACKED_N(name, vec64_len(type), code)
#define GEN_HELPER_PACKED_OP(name, type, op) \
GEN_HELPER_PACKED_N(name, vec64_len(type), { \
dst.type[i] = op(s1.type[i], s2.type[i]); \
})
#define GEN_HELPER_PACKED_SCALAR(name, type, code) \
uint64_t HELPER(name)(uint64_t src1, uint64_t s2) \
{ \
@ -184,6 +188,12 @@ GEN_HELPER_PACKED(pmulubhh, uh, { \
dst.uh[i] = (((int16_t) s1.ub[i] * s2.sh[i]) + s1.ub[i]) >> 8; \
})
#define mul_sign(a, b) ((b) < 0 ? -(a) : ((b) > 0 ? (a) : 0))
GEN_HELPER_PACKED_OP(psignb, sb, mul_sign)
GEN_HELPER_PACKED_OP(psignh, sh, mul_sign)
GEN_HELPER_PACKED_OP(psignw, sw, mul_sign)
#define MOVMASK(mask_type, type) { \
dst.mask_type[0] |= (s1.type[i] < 0) << (i + glue(vec64_, type)); \
dst.mask_type[0] |= (s2.type[i] < 0) << (i ); \

View File

@ -3113,6 +3113,9 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PMADDH: gen_alopf1_ddd(instr, gen_helper_pmaddh); break;
case OP_PMADDUBSH: gen_alopf1_ddd(instr, gen_helper_pmaddubsh); break;
case OP_PSADBW: gen_alopf1_ddd(instr, gen_helper_psadbw); break;
case OP_PSIGNB: gen_alopf1_ddd(instr, gen_helper_psignb); break;
case OP_PSIGNH: gen_alopf1_ddd(instr, gen_helper_psignh); break;
case OP_PSIGNW: gen_alopf1_ddd(instr, gen_helper_psignw); break;
case OP_PSLLH: gen_alopf1_ddd(instr, gen_helper_psllh); break;
case OP_PSLLW: gen_alopf1_ddd(instr, gen_helper_psllw); break;
case OP_PSLLD: gen_alopf1_ddd(instr, tcg_gen_shl_i64); break;
@ -3440,9 +3443,6 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PFADDSUBS:
case OP_PFSTOIFS:
case OP_PFDTOIFD:
case OP_PSIGNB:
case OP_PSIGNH:
case OP_PSIGNW:
case OP_PMULHRSH:
case OP_PHMINPOSUH:
case OP_PUTTST: