mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
tcg: Convert sextract to TCGOutOpExtract
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
07d5d502f2
commit
05a1129e23
11 changed files with 188 additions and 151 deletions
|
@ -2221,6 +2221,30 @@ static const TCGOutOpExtract outop_extract = {
|
|||
.out_rr = tgen_extract,
|
||||
};
|
||||
|
||||
static void tgen_sextract(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1,
|
||||
unsigned ofs, unsigned len)
|
||||
{
|
||||
if (ofs == 0) {
|
||||
switch (len) {
|
||||
case 8:
|
||||
tcg_out_ext8s(s, type, a0, a1);
|
||||
return;
|
||||
case 16:
|
||||
tcg_out_ext16s(s, type, a0, a1);
|
||||
return;
|
||||
case 32:
|
||||
tcg_out_ext32s(s, a0, a1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
static const TCGOutOpExtract outop_sextract = {
|
||||
.base.static_constraint = C_O1_I1(r, r),
|
||||
.out_rr = tgen_sextract,
|
||||
};
|
||||
|
||||
static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type,
|
||||
const TCGArg args[TCG_MAX_OP_ARGS],
|
||||
const int const_args[TCG_MAX_OP_ARGS])
|
||||
|
@ -2303,22 +2327,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, TCGType type,
|
|||
args[3] + args[4] - 1, args[3]);
|
||||
break;
|
||||
|
||||
case INDEX_op_sextract_i64:
|
||||
if (a2 == 0 && args[3] == 32) {
|
||||
tcg_out_ext32s(s, a0, a1);
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case INDEX_op_sextract_i32:
|
||||
if (a2 == 0 && args[3] == 8) {
|
||||
tcg_out_ext8s(s, TCG_TYPE_REG, a0, a1);
|
||||
} else if (a2 == 0 && args[3] == 16) {
|
||||
tcg_out_ext16s(s, TCG_TYPE_REG, a0, a1);
|
||||
} else {
|
||||
g_assert_not_reached();
|
||||
}
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld_i32:
|
||||
tcg_out_qemu_ld(s, a0, 0, a1, a2, TCG_TYPE_I32);
|
||||
break;
|
||||
|
@ -2376,7 +2384,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags)
|
|||
case INDEX_op_ld16u_i32:
|
||||
case INDEX_op_ld16s_i32:
|
||||
case INDEX_op_ld_i32:
|
||||
case INDEX_op_sextract_i32:
|
||||
case INDEX_op_ld8u_i64:
|
||||
case INDEX_op_ld8s_i64:
|
||||
case INDEX_op_ld16u_i64:
|
||||
|
@ -2388,7 +2395,6 @@ tcg_target_op_def(TCGOpcode op, TCGType type, unsigned flags)
|
|||
case INDEX_op_extu_i32_i64:
|
||||
case INDEX_op_extrl_i64_i32:
|
||||
case INDEX_op_extrh_i64_i32:
|
||||
case INDEX_op_sextract_i64:
|
||||
return C_O1_I1(r, r);
|
||||
|
||||
case INDEX_op_st8_i32:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue