target/arm: Remove redundant shift tests

The immediate shift generator functions already test for,
and eliminate, the case of a shift by zero.

Backports commit 464eaa9571fae5867d9aea7d7209c091c8a50223 from qemu
This commit is contained in:
Richard Henderson 2019-11-18 20:24:31 -05:00 committed by Lioncash
parent 4dd30ebfbd
commit df4c773ed2
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -8994,7 +8994,6 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
shift = (insn >> 10) & 3;
/* ??? In many cases it's not necessary to do a
rotate, a shift is sufficient. */
if (shift != 0)
tcg_gen_rotri_i32(tcg_ctx, tmp, tmp, shift * 8);
op1 = (insn >> 20) & 7;
switch (op1) {
@ -10068,7 +10067,6 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
shift = (insn >> 4) & 3;
/* ??? In many cases it's not necessary to do a
rotate, a shift is sufficient. */
if (shift != 0)
tcg_gen_rotri_i32(tcg_ctx, tmp, tmp, shift * 8);
op = (insn >> 20) & 7;
switch (op) {
@ -10796,10 +10794,9 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
case 7:
goto illegal_op;
default: /* Saturate. */
if (shift) {
if (op & 1)
if (op & 1) {
tcg_gen_sari_i32(tcg_ctx, tmp, tmp, shift);
else
} else {
tcg_gen_shli_i32(tcg_ctx, tmp, tmp, shift);
}
tmp2 = tcg_const_i32(tcg_ctx, imm);
@ -10991,9 +10988,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
goto illegal_op;
}
tmp = load_reg(s, rm);
if (shift) {
tcg_gen_shli_i32(tcg_ctx, tmp, tmp, shift);
}
tcg_gen_add_i32(tcg_ctx, addr, addr, tmp);
tcg_temp_free_i32(tcg_ctx, tmp);
break;