e2k: Add packed shift inters.

This commit is contained in:
Denis Drakhnia 2021-01-15 23:22:28 +02:00 committed by Denis Drakhnia
parent d233d8afa5
commit a074d1d1ad
3 changed files with 32 additions and 6 deletions

View File

@ -70,6 +70,12 @@ DEF_HELPER_2(psubsh, i64, i64, i64)
DEF_HELPER_2(psubusb, i64, i64, i64)
DEF_HELPER_2(psubush, i64, i64, i64)
/* Packed shifts */
DEF_HELPER_2(psllh, i64, i64, i64)
DEF_HELPER_2(psllw, i64, i64, i64)
DEF_HELPER_2(psrlh, i64, i64, i64)
DEF_HELPER_2(psrlw, i64, i64, i64)
/* Float 32/64 Ops */
#define DEF_HELPER_3_32_64(name) \
DEF_HELPER_3(name##s, i32, env, i32, i32) \

View File

@ -114,6 +114,16 @@ uint64_t HELPER(packed_shuffle_i64)(uint64_t src1, uint64_t src2, uint64_t src3)
} \
return dst.ud[0]; \
}
#define GEN_HELPER_PACKED_SCALAR(name, type, code) \
uint64_t HELPER(name)(uint64_t src1, uint64_t s2) \
{ \
size_t i = 0; \
vec64 s1 = { .ud[0] = src1 }, dst; \
for (; i < glue(vec64_, type); i++) { \
code \
} \
return dst.ud[0]; \
}
#define GEN_HELPER_PACKED_MINMAX(name, type, op) \
GEN_HELPER_PACKED(glue(name, type), type, { \
dst.type[i] = op(s1.type[i], s2.type[i]); \
@ -163,6 +173,16 @@ GEN_HELPER_PACKED_BINOP_SATURATE(psubsh, sh, -, int, -32768, 32767)
GEN_HELPER_PACKED_BINOP_SATURATE(psubusb, ub, -, int, 0, 255)
GEN_HELPER_PACKED_BINOP_SATURATE(psubush, uh, -, int, 0, 65535)
#define GEN_HELPER_PACKED_SCALAR_BINOP(name, type, op) \
GEN_HELPER_PACKED_SCALAR(name, type, { \
dst.type[i] = s1.type[i] op s2; \
})
GEN_HELPER_PACKED_SCALAR_BINOP(psllh, uh, <<)
GEN_HELPER_PACKED_SCALAR_BINOP(psllw, uw, <<)
GEN_HELPER_PACKED_SCALAR_BINOP(psrlh, uh, >>)
GEN_HELPER_PACKED_SCALAR_BINOP(psrlw, uw, >>)
uint64_t HELPER(pmovmskb)(uint64_t src1, uint64_t src2)
{
unsigned int i;

View File

@ -2970,6 +2970,12 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PSUBSH: gen_alopf1_ddd(instr, gen_helper_psubsh); break;
case OP_PSUBUSB: gen_alopf1_ddd(instr, gen_helper_psubusb); break;
case OP_PSUBUSH: gen_alopf1_ddd(instr, gen_helper_psubush); 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;
case OP_PSRLH: gen_alopf1_ddd(instr, gen_helper_psrlh); break;
case OP_PSRLW: gen_alopf1_ddd(instr, gen_helper_psrlw); break;
case OP_PSRLD: gen_alopf1_ddd(instr, tcg_gen_shr_i64); break;
case OP_GETTAGS: gen_gettag_i32(instr); break;
case OP_GETTAGD: gen_gettag_i64(instr); break;
case OP_PUTTAGS: gen_puttag_i32(instr); break;
@ -3129,12 +3135,6 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PMULHH:
case OP_PMULLH:
case OP_PMADDH:
case OP_PSLLD:
case OP_PSLLW:
case OP_PSLLH:
case OP_PSRLD:
case OP_PSRLW:
case OP_PSRLH:
case OP_PSRAW:
case OP_PSRAH:
case OP_PFADDS: