e2k: Add pmadd{h,ubsh} instrs.

This commit is contained in:
Denis Drakhnia 2021-01-16 01:00:47 +02:00 committed by Denis Drakhnia
parent 7cb77dbe33
commit 0a7e3625e9
3 changed files with 24 additions and 2 deletions

View File

@ -80,6 +80,10 @@ DEF_HELPER_2(psrlw, i64, i64, i64)
DEF_HELPER_2(psrah, i64, i64, i64)
DEF_HELPER_2(psraw, i64, i64, i64)
/* Packed Mul */
DEF_HELPER_2(pmaddh, i64, i64, i64)
DEF_HELPER_2(pmaddubsh, 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

@ -191,6 +191,24 @@ GEN_HELPER_PACKED_SCALAR_BINOP(psrlw, uw, >>)
GEN_HELPER_PACKED_SRA(psrah, sh, int32_t)
GEN_HELPER_PACKED_SRA(psraw, sw, int64_t)
#define GEN_HELPER_PACKED_MAD(name, dst_type, type, cast, op) \
uint64_t HELPER(name)(uint64_t src1, uint64_t src2) \
{ \
size_t i = 0; \
vec64 s1 = { .ud[0] = src1 }, s2 = { .ud[0] = src2 }, dst; \
for (; i < glue(vec64_, type); i += 2) { \
dst.dst_type[i >> 1] = op((cast) s1.type[i + 1] * s2.type[i + 1] +\
(cast) s1.type[i ] * s2.type[i ]); \
} \
return dst.ud[0]; \
}
#define ident(x) x
#define satsh(x) MIN(MAX(x, -32768), 32767)
GEN_HELPER_PACKED_MAD(pmaddh, sw, sh, int32_t, ident)
GEN_HELPER_PACKED_MAD(pmaddubsh, sh, ub, int16_t, satsh)
uint64_t HELPER(pmovmskb)(uint64_t src1, uint64_t src2)
{
unsigned int i;

View File

@ -3053,6 +3053,8 @@ 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_PMADDH: gen_alopf1_ddd(instr, gen_helper_pmaddh); break;
case OP_PMADDUBSH: gen_alopf1_ddd(instr, gen_helper_pmaddubsh); 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;
@ -3223,7 +3225,6 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PMULHUH:
case OP_PMULHH:
case OP_PMULLH:
case OP_PMADDH:
case OP_PFADDS:
case OP_PFADDD:
case OP_PFSUBS:
@ -3399,7 +3400,6 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PSIGNB:
case OP_PSIGNH:
case OP_PSIGNW:
case OP_PMADDUBSH:
case OP_PMULHRSH:
case OP_PHMINPOSUH:
case OP_PUTTST: