e2k: Add pshufh instr.

This commit is contained in:
Denis Drakhnia 2021-01-16 13:14:23 +02:00 committed by Denis Drakhnia
parent 8606e02150
commit 0b7c8d2650
3 changed files with 26 additions and 1 deletions

View File

@ -105,6 +105,7 @@ DEF_HELPER_2(punpckhwd, i64, i64, i64)
/* Packed shuffle */
DEF_HELPER_3(pshufb, i64, i64, i64, i64)
DEF_HELPER_2(pshufh, i64, i64, i32)
DEF_HELPER_3(pshufw, i64, i64, i64, i32)
/* Packed uncategorized */

View File

@ -256,6 +256,17 @@ uint64_t HELPER(pshufb)(uint64_t src1, uint64_t src2, uint64_t src3)
return ret.ud[0];
}
uint64_t HELPER(pshufh)(uint64_t src1, uint32_t imm8)
{
int i;
vec64 s1 = { .ud[0] = src1 }, dst;
for (i = 0; i < vec64_uh; i++) {
int j = (imm8 >> (i * 2)) & 0x3;
dst.uh[i] = s1.uh[j];
}
return dst.ud[0];
}
uint64_t HELPER(pshufw)(uint64_t src1, uint64_t src2, uint32_t imm8)
{
int i;

View File

@ -1910,6 +1910,19 @@ static inline void gen_pextrh(TCGv_i64 ret, TCGv_i64 src1,
}
}
static inline void gen_pshufh(Instr *instr)
{
Src64 s2 = get_src2_i64(instr);
TCGv_i32 tag = get_temp_i32(instr);
TCGv_i64 dst = get_temp_i64(instr);
TCGv_i32 t0 = tcg_const_i32(instr->src3);
gen_tag1_i64(tag, s2.tag);
gen_helper_pshufh(dst, s2.value, t0);
gen_al_result_i64(instr, dst, tag);
tcg_temp_free_i32(t0);
}
static inline void gen_pshufw(TCGv_i64 ret, TCGv_i64 src1,
TCGv_i64 src2, int i)
{
@ -3109,6 +3122,7 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_PSRLQH: gen_alopf11_dddi(instr, gen_psrlqh); break;
case OP_PINSH: gen_alopf11_dddi(instr, gen_pinsh); break;
case OP_PEXTRH: gen_alopf11_dddi(instr, gen_pextrh); break;
case OP_PSHUFH: gen_pshufh(instr); break;
case OP_PSHUFW: gen_alopf11_dddi(instr, gen_pshufw); break;
case OP_PMOVMSKB: gen_alopf1_ddd(instr, gen_helper_pmovmskb); break;
case OP_PMOVMSKPS: gen_alopf1_ddd(instr, gen_helper_pmovmskps); break;
@ -3371,7 +3385,6 @@ static void gen_op(DisasContext *ctx, Instr *instr)
case OP_GETTC:
case OP_INVTC:
case OP_GETSOD:
case OP_PSHUFH:
case OP_STCSQ:
case OP_STDSQ:
case OP_STESQ: