target/arm: Use tcg_gen_deposit_i32 for PKHBT, PKHTB

Use deposit as the composit operation to merge the
bits from the two inputs.

Backports commit d1f8755fc93911f5b27246b1da794542d222fa1b from qemu
This commit is contained in:
Richard Henderson 2019-11-18 20:21:56 -05:00 committed by Lioncash
parent 25ccd28e78
commit 4dd30ebfbd
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -8937,19 +8937,16 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
shift = (insn >> 7) & 0x1f; shift = (insn >> 7) & 0x1f;
if (insn & (1 << 6)) { if (insn & (1 << 6)) {
/* pkhtb */ /* pkhtb */
if (shift == 0) if (shift == 0) {
shift = 31; shift = 31;
}
tcg_gen_sari_i32(tcg_ctx, tmp2, tmp2, shift); tcg_gen_sari_i32(tcg_ctx, tmp2, tmp2, shift);
tcg_gen_andi_i32(tcg_ctx, tmp, tmp, 0xffff0000); tcg_gen_deposit_i32(tcg_ctx, tmp, tmp, tmp2, 0, 16);
tcg_gen_ext16u_i32(tcg_ctx, tmp2, tmp2);
} else { } else {
/* pkhbt */ /* pkhbt */
if (shift) tcg_gen_shli_i32(tcg_ctx, tmp2, tmp2, shift);
tcg_gen_shli_i32(tcg_ctx, tmp2, tmp2, shift); tcg_gen_deposit_i32(tcg_ctx, tmp, tmp2, tmp, 0, 16);
tcg_gen_ext16u_i32(tcg_ctx, tmp, tmp);
tcg_gen_andi_i32(tcg_ctx, tmp2, tmp2, 0xffff0000);
} }
tcg_gen_or_i32(tcg_ctx, tmp, tmp, tmp2);
tcg_temp_free_i32(tcg_ctx, tmp2); tcg_temp_free_i32(tcg_ctx, tmp2);
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else if ((insn & 0x00200020) == 0x00200000) { } else if ((insn & 0x00200020) == 0x00200000) {
@ -9981,19 +9978,16 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
shift = ((insn >> 10) & 0x1c) | ((insn >> 6) & 0x3); shift = ((insn >> 10) & 0x1c) | ((insn >> 6) & 0x3);
if (insn & (1 << 5)) { if (insn & (1 << 5)) {
/* pkhtb */ /* pkhtb */
if (shift == 0) if (shift == 0) {
shift = 31; shift = 31;
}
tcg_gen_sari_i32(tcg_ctx, tmp2, tmp2, shift); tcg_gen_sari_i32(tcg_ctx, tmp2, tmp2, shift);
tcg_gen_andi_i32(tcg_ctx, tmp, tmp, 0xffff0000); tcg_gen_deposit_i32(tcg_ctx, tmp, tmp, tmp2, 0, 16);
tcg_gen_ext16u_i32(tcg_ctx, tmp2, tmp2);
} else { } else {
/* pkhbt */ /* pkhbt */
if (shift) tcg_gen_shli_i32(tcg_ctx, tmp2, tmp2, shift);
tcg_gen_shli_i32(tcg_ctx, tmp2, tmp2, shift); tcg_gen_deposit_i32(tcg_ctx, tmp, tmp2, tmp, 0, 16);
tcg_gen_ext16u_i32(tcg_ctx, tmp, tmp);
tcg_gen_andi_i32(tcg_ctx, tmp2, tmp2, 0xffff0000);
} }
tcg_gen_or_i32(tcg_ctx, tmp, tmp, tmp2);
tcg_temp_free_i32(tcg_ctx, tmp2); tcg_temp_free_i32(tcg_ctx, tmp2);
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else { } else {