[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64()
From: |
Richard Henderson |
Subject: |
[PULL 10/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64() |
Date: |
Tue, 2 Nov 2021 06:59:32 -0400 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
The immediate value used for comparison is constant and
read-only. Move it to the constant pool. This frees a
TCG temporary for unsigned saturation opcodes.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211029231834.2476117-5-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-sve.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index bc91a64171..76b5fe9f31 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1943,20 +1943,20 @@ static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64
val, bool u, bool d)
static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d)
{
TCGv_i64 t0 = tcg_temp_new_i64();
- TCGv_i64 t1 = tcg_temp_new_i64();
TCGv_i64 t2;
if (u) {
if (d) {
tcg_gen_sub_i64(t0, reg, val);
- tcg_gen_movi_i64(t1, 0);
- tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t1, t0);
+ t2 = tcg_constant_i64(0);
+ tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t2, t0);
} else {
tcg_gen_add_i64(t0, reg, val);
- tcg_gen_movi_i64(t1, -1);
- tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t1, t0);
+ t2 = tcg_constant_i64(-1);
+ tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t2, t0);
}
} else {
+ TCGv_i64 t1 = tcg_temp_new_i64();
if (d) {
/* Detect signed overflow for subtraction. */
tcg_gen_xor_i64(t0, reg, val);
@@ -1966,7 +1966,7 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val,
bool u, bool d)
/* Bound the result. */
tcg_gen_movi_i64(reg, INT64_MIN);
- t2 = tcg_const_i64(0);
+ t2 = tcg_constant_i64(0);
tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, reg, t1);
} else {
/* Detect signed overflow for addition. */
@@ -1977,13 +1977,12 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64
val, bool u, bool d)
/* Bound the result. */
tcg_gen_movi_i64(t1, INT64_MAX);
- t2 = tcg_const_i64(0);
+ t2 = tcg_constant_i64(0);
tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, t1, reg);
}
- tcg_temp_free_i64(t2);
+ tcg_temp_free_i64(t1);
}
tcg_temp_free_i64(t0);
- tcg_temp_free_i64(t1);
}
/* Similarly with a vector and a scalar operand. */
--
2.25.1
- [PULL 00/12] target/arm patch queue, Richard Henderson, 2021/11/02
- [PULL 01/12] hw/sd: add nuvoton MMC, Richard Henderson, 2021/11/02
- [PULL 02/12] hw/arm: Add Nuvoton SD module to board, Richard Henderson, 2021/11/02
- [PULL 03/12] hw/arm: Attach MMC to quanta-gbs-bmc, Richard Henderson, 2021/11/02
- [PULL 04/12] tests/qtest/libqos: add SDHCI commands, Richard Henderson, 2021/11/02
- [PULL 05/12] tests/qtest: add qtests for npcm7xx sdhci, Richard Henderson, 2021/11/02
- [PULL 07/12] target/arm: Use tcg_constant_i32() in op_smlad(), Richard Henderson, 2021/11/02
- [PULL 08/12] target/arm: Introduce store_cpu_field_constant() helper, Richard Henderson, 2021/11/02
- [PULL 09/12] target/arm: Use the constant variant of store_cpu_field() when possible, Richard Henderson, 2021/11/02
- [PULL 10/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64(),
Richard Henderson <=
- [PULL 06/12] target/arm: Advertise MVE to gdb when present, Richard Henderson, 2021/11/02
- [PULL 11/12] target/arm: Use tcg_constant_i32() in gen_rev16(), Richard Henderson, 2021/11/02
- [PULL 12/12] hw/arm/virt: Rename default_bus_bypass_iommu, Richard Henderson, 2021/11/02