tcg/loongarch64: Simplify tcg_out_dup_vec

Reviewed-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-05-27 18:45:20 +00:00
parent 9d779187b8
commit 4f222d8909

View file

@ -1674,22 +1674,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
TCGReg rd, TCGReg rs) TCGReg rd, TCGReg rs)
{ {
switch (vece) { static const LoongArchInsn repl_insn[4] = {
case MO_8: OPC_VREPLGR2VR_B, OPC_VREPLGR2VR_H, OPC_VREPLGR2VR_W, OPC_VREPLGR2VR_D
tcg_out_opc_vreplgr2vr_b(s, rd, rs); };
break;
case MO_16: tcg_debug_assert(vece <= MO_64);
tcg_out_opc_vreplgr2vr_h(s, rd, rs); tcg_out32(s, encode_vdj_insn(repl_insn[vece], rd, rs));
break;
case MO_32:
tcg_out_opc_vreplgr2vr_w(s, rd, rs);
break;
case MO_64:
tcg_out_opc_vreplgr2vr_d(s, rd, rs);
break;
default:
g_assert_not_reached();
}
return true; return true;
} }