From 25ccd28e78a14b2040fa8613037d1f7c2e42cf7a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 18 Nov 2019 20:19:30 -0500 Subject: [PATCH] target/arm: Use tcg_gen_extract_i32 for shifter_out_im Extract is a compact combination of shift + and. Backports commit 191f4bfe8d6cf0c7d5cd7f84cd7076e32e3745dd from qemu --- qemu/target/arm/translate.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 316451e9..aaad64d0 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -631,14 +631,7 @@ static void gen_sar(DisasContext *s, TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) static void shifter_out_im(DisasContext *s, TCGv_i32 var, int shift) { TCGContext *tcg_ctx = s->uc->tcg_ctx; - if (shift == 0) { - tcg_gen_andi_i32(tcg_ctx, tcg_ctx->cpu_CF, var, 1); - } else { - tcg_gen_shri_i32(tcg_ctx, tcg_ctx->cpu_CF, var, shift); - if (shift != 31) { - tcg_gen_andi_i32(tcg_ctx, tcg_ctx->cpu_CF, tcg_ctx->cpu_CF, 1); - } - } + tcg_gen_extract_i32(tcg_ctx, tcg_ctx->cpu_CF, var, shift, 1); } /* Shift by immediate. Includes special handling for shift == 0. */