From 7fa077d55752ed200d9caf48045d20690ef995e8 Mon Sep 17 00:00:00 2001 From: Denis Drakhnya Date: Sat, 16 Jan 2021 01:58:45 +0200 Subject: [PATCH] e2k: Add pmulhh, pmulhuh and pmullh instrs. --- target/e2k/helper.h | 3 +++ target/e2k/helper_vec.c | 10 ++++++++++ target/e2k/translate/alc.c | 6 +++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/target/e2k/helper.h b/target/e2k/helper.h index 443302bbb9..b4e9269aef 100644 --- a/target/e2k/helper.h +++ b/target/e2k/helper.h @@ -83,6 +83,9 @@ DEF_HELPER_2(psraw, i64, i64, i64) /* Packed Mul */ DEF_HELPER_2(pmaddh, i64, i64, i64) DEF_HELPER_2(pmaddubsh, i64, i64, i64) +DEF_HELPER_2(pmulhh, i64, i64, i64) +DEF_HELPER_2(pmullh, i64, i64, i64) +DEF_HELPER_2(pmulhuh, i64, i64, i64) /* Packed uncategorized */ DEF_HELPER_2(psadbw, i64, i64, i64) diff --git a/target/e2k/helper_vec.c b/target/e2k/helper_vec.c index bef7ea2789..9910d8bc07 100644 --- a/target/e2k/helper_vec.c +++ b/target/e2k/helper_vec.c @@ -215,6 +215,16 @@ GEN_HELPER_PACKED(psadbw, ub, { dst.uw[0] += s1.ub[i] - s2.ub[i]; }) GEN_HELPER_PACKED(pavgusb, ub, { dst.ub[i] = (s1.ub[i] + s2.ub[i] + 1) >> 1; }) GEN_HELPER_PACKED(pavgush, uh, { dst.uh[i] = (s1.uh[i] + s2.uh[i] + 1) >> 1; }) +GEN_HELPER_PACKED(pmulhh, sh, { \ + dst.sh[i] = ((int32_t) s1.sh[i] * s2.sh[i]) >> 16; \ +}) +GEN_HELPER_PACKED(pmullh, sh, { \ + dst.sh[i] = ((int32_t) s1.sh[i] * s2.sh[i]) & 0xffff; \ +}) +GEN_HELPER_PACKED(pmulhuh, uh, { \ + dst.uh[i] = ((uint32_t) s1.uh[i] * s2.uh[i]) >> 16; \ +}) + uint64_t HELPER(pmovmskb)(uint64_t src1, uint64_t src2) { int i; diff --git a/target/e2k/translate/alc.c b/target/e2k/translate/alc.c index 71202fc14a..565a34f25d 100644 --- a/target/e2k/translate/alc.c +++ b/target/e2k/translate/alc.c @@ -3057,6 +3057,9 @@ 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_PMULHH: gen_alopf1_ddd(instr, gen_helper_pmulhh); break; + case OP_PMULLH: gen_alopf1_ddd(instr, gen_helper_pmullh); break; + case OP_PMULHUH: gen_alopf1_ddd(instr, gen_helper_pmulhuh); 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_PSADBW: gen_alopf1_ddd(instr, gen_helper_psadbw); break; @@ -3228,9 +3231,6 @@ static void gen_op(DisasContext *ctx, Instr *instr) case OP_FSQRTTD: case OP_PFMULS: case OP_PFMULD: - case OP_PMULHUH: - case OP_PMULHH: - case OP_PMULLH: case OP_PFADDS: case OP_PFADDD: case OP_PFSUBS: