[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] target/arm: Use deposit_z() in BCF opcode
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH] target/arm: Use deposit_z() in BCF opcode |
Date: |
Tue, 22 Aug 2023 11:51:56 +0200 |
When clearing a bitfield we don't need to lead the
source register. Use deposit_z_i32() with the BFC
opcode to save a load_reg() call.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/tcg/translate.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index b71ac2d0d5..1a6938d1b3 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -7255,7 +7255,7 @@ static bool trans_UBFX(DisasContext *s, arg_UBFX *a)
static bool trans_BFCI(DisasContext *s, arg_BFCI *a)
{
int msb = a->msb, lsb = a->lsb;
- TCGv_i32 t_in, t_rd;
+ TCGv_i32 t_rd;
int width;
if (!ENABLE_ARCH_6T2) {
@@ -7268,15 +7268,14 @@ static bool trans_BFCI(DisasContext *s, arg_BFCI *a)
}
width = msb + 1 - lsb;
+ t_rd = load_reg(s, a->rd);
if (a->rn == 15) {
/* BFC */
- t_in = tcg_constant_i32(0);
+ tcg_gen_deposit_z_i32(t_rd, t_rd, lsb, width);
} else {
/* BFI */
- t_in = load_reg(s, a->rn);
+ tcg_gen_deposit_i32(t_rd, t_rd, load_reg(s, a->rn), lsb, width);
}
- t_rd = load_reg(s, a->rd);
- tcg_gen_deposit_i32(t_rd, t_rd, t_in, lsb, width);
store_reg(s, a->rd, t_rd);
return true;
}
--
2.41.0
- [PATCH] target/arm: Use deposit_z() in BCF opcode,
Philippe Mathieu-Daudé <=