target/ppc: Use tcg_gen_gvec_dup_imm

We can now unify the implementation of the 3 VSPLTI instructions.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2020-03-28 14:58:36 -07:00
parent 8703cfbf98
commit 36af59d062
2 changed files with 19 additions and 15 deletions

View File

@ -1035,21 +1035,25 @@ GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \
GEN_VXRFORM_DUAL(vcmpgtfp, PPC_ALTIVEC, PPC_NONE, \ GEN_VXRFORM_DUAL(vcmpgtfp, PPC_ALTIVEC, PPC_NONE, \
vcmpgtud, PPC_NONE, PPC2_ALTIVEC_207) vcmpgtud, PPC_NONE, PPC2_ALTIVEC_207)
#define GEN_VXFORM_DUPI(name, tcg_op, opc2, opc3) \ static void gen_vsplti(DisasContext *ctx, int vece)
static void glue(gen_, name)(DisasContext *ctx) \ {
{ \ int simm;
int simm; \
if (unlikely(!ctx->altivec_enabled)) { \ if (unlikely(!ctx->altivec_enabled)) {
gen_exception(ctx, POWERPC_EXCP_VPU); \ gen_exception(ctx, POWERPC_EXCP_VPU);
return; \ return;
} \
simm = SIMM5(ctx->opcode); \
tcg_op(avr_full_offset(rD(ctx->opcode)), 16, 16, simm); \
} }
GEN_VXFORM_DUPI(vspltisb, tcg_gen_gvec_dup8i, 6, 12); simm = SIMM5(ctx->opcode);
GEN_VXFORM_DUPI(vspltish, tcg_gen_gvec_dup16i, 6, 13); tcg_gen_gvec_dup_imm(vece, avr_full_offset(rD(ctx->opcode)), 16, 16, simm);
GEN_VXFORM_DUPI(vspltisw, tcg_gen_gvec_dup32i, 6, 14); }
#define GEN_VXFORM_VSPLTI(name, vece, opc2, opc3) \
static void glue(gen_, name)(DisasContext *ctx) { gen_vsplti(ctx, vece); }
GEN_VXFORM_VSPLTI(vspltisb, MO_8, 6, 12);
GEN_VXFORM_VSPLTI(vspltish, MO_16, 6, 13);
GEN_VXFORM_VSPLTI(vspltisw, MO_32, 6, 14);
#define GEN_VXFORM_NOA(name, opc2, opc3) \ #define GEN_VXFORM_NOA(name, opc2, opc3) \
static void glue(gen_, name)(DisasContext *ctx) \ static void glue(gen_, name)(DisasContext *ctx) \
@ -1559,7 +1563,7 @@ GEN_VXFORM_DUAL(vsldoi, PPC_ALTIVEC, PPC_NONE,
#undef GEN_VXRFORM_DUAL #undef GEN_VXRFORM_DUAL
#undef GEN_VXRFORM1 #undef GEN_VXRFORM1
#undef GEN_VXRFORM #undef GEN_VXRFORM
#undef GEN_VXFORM_DUPI #undef GEN_VXFORM_VSPLTI
#undef GEN_VXFORM_NOA #undef GEN_VXFORM_NOA
#undef GEN_VXFORM_UIMM #undef GEN_VXFORM_UIMM
#undef GEN_VAFORM_PAIRED #undef GEN_VAFORM_PAIRED

View File

@ -1579,7 +1579,7 @@ static void gen_xxspltib(DisasContext *ctx)
return; return;
} }
} }
tcg_gen_gvec_dup8i(vsr_full_offset(rt), 16, 16, uim8); tcg_gen_gvec_dup_imm(MO_8, vsr_full_offset(rt), 16, 16, uim8);
} }
static void gen_xxsldwi(DisasContext *ctx) static void gen_xxsldwi(DisasContext *ctx)