tcg/arm: Support INDEX_op_extract2_i32

Backports commit 3b832d67a993968868f4087a9720a5c911e23f7a from qemu
This commit is contained in:
Richard Henderson 2019-04-30 09:39:28 -04:00 committed by Lioncash
parent 0f20a26b36
commit cbc5f919c2
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 25 additions and 1 deletions

View file

@ -117,7 +117,7 @@ extern bool use_idiv_instructions_rt;
#define TCG_TARGET_HAS_deposit_i32 use_armv7_instructions
#define TCG_TARGET_HAS_extract_i32 use_armv7_instructions
#define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions
#define TCG_TARGET_HAS_extract2_i32 0
#define TCG_TARGET_HAS_extract2_i32 1
#define TCG_TARGET_HAS_movcond_i32 1
#define TCG_TARGET_HAS_mulu2_i32 1
#define TCG_TARGET_HAS_muls2_i32 1

View file

@ -2064,6 +2064,27 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
case INDEX_op_sextract_i32:
tcg_out_sextract(s, COND_AL, args[0], args[1], args[2], args[3]);
break;
case INDEX_op_extract2_i32:
/* ??? These optimization vs zero should be generic. */
/* ??? But we can't substitute 2 for 1 in the opcode stream yet. */
if (const_args[1]) {
if (const_args[2]) {
tcg_out_movi(s, TCG_TYPE_REG, args[0], 0);
} else {
tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0,
args[2], SHIFT_IMM_LSL(32 - args[3]));
}
} else if (const_args[2]) {
tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0,
args[1], SHIFT_IMM_LSR(args[3]));
} else {
/* We can do extract2 in 2 insns, vs the 3 required otherwise. */
tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0,
args[2], SHIFT_IMM_LSL(32 - args[3]));
tcg_out_dat_reg(s, COND_AL, ARITH_ORR, args[0], TCG_REG_TMP,
args[1], SHIFT_IMM_LSR(args[3]));
}
break;
case INDEX_op_div_i32:
tcg_out_sdiv(s, COND_AL, args[0], args[1], args[2]);
@ -2102,6 +2123,7 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
static const TCGTargetOpDef r_r_l_l = { 0, { "r", "r", "l", "l" } };
static const TCGTargetOpDef s_s_s_s = { 0, { "s", "s", "s", "s" } };
static const TCGTargetOpDef br = { 0, { "r", "rIN" } };
static const TCGTargetOpDef ext2 = { 0, { "r", "rZ", "rZ" } };
static const TCGTargetOpDef dep = { 0, { "r", "0", "rZ" } };
static const TCGTargetOpDef movc = { 0, { "r", "r", "rIN", "rIK", "0" } };
static const TCGTargetOpDef add2 = { 0, { "r", "r", "r", "r", "rIN", "rIK" } };
@ -2159,6 +2181,8 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
return &br;
case INDEX_op_deposit_i32:
return &dep;
case INDEX_op_extract2_i32:
return &ext2;
case INDEX_op_movcond_i32:
return &movc;
case INDEX_op_add2_i32: