[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 89/91] target/tricore: Use min/max for saturate
From: |
Richard Henderson |
Subject: |
[PULL v2 89/91] target/tricore: Use min/max for saturate |
Date: |
Thu, 9 Mar 2023 12:05:48 -0800 |
Use tcg_constant_i32 for the bounds.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/tricore/translate.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index a3a5263a5d..2646cb3eb5 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -2443,21 +2443,13 @@ gen_msubsui_64(TCGv ret_low, TCGv ret_high, TCGv r1,
TCGv r2_low, TCGv r2_high,
static void gen_saturate(TCGv ret, TCGv arg, int32_t up, int32_t low)
{
- TCGv sat_neg = tcg_const_i32(low);
- TCGv temp = tcg_const_i32(up);
-
- /* sat_neg = (arg < low ) ? low : arg; */
- tcg_gen_movcond_tl(TCG_COND_LT, sat_neg, arg, sat_neg, sat_neg, arg);
-
- /* ret = (sat_neg > up ) ? up : sat_neg; */
- tcg_gen_movcond_tl(TCG_COND_GT, ret, sat_neg, temp, temp, sat_neg);
+ tcg_gen_smax_tl(ret, arg, tcg_constant_i32(low));
+ tcg_gen_smin_tl(ret, ret, tcg_constant_i32(up));
}
static void gen_saturate_u(TCGv ret, TCGv arg, int32_t up)
{
- TCGv temp = tcg_const_i32(up);
- /* sat_neg = (arg > up ) ? up : arg; */
- tcg_gen_movcond_tl(TCG_COND_GTU, ret, arg, temp, temp, arg);
+ tcg_gen_umin_tl(ret, arg, tcg_constant_i32(up));
}
static void gen_shi(TCGv ret, TCGv r1, int32_t shift_count)
--
2.34.1
- [PULL v2 72/91] target/arm: Create gen_set_rmode, gen_restore_rmode, (continued)
- [PULL v2 72/91] target/arm: Create gen_set_rmode, gen_restore_rmode, Richard Henderson, 2023/03/09
- [PULL v2 79/91] target/m68k: Use tcg_constant_i32 in gen_ea_mode, Richard Henderson, 2023/03/09
- [PULL v2 77/91] target/arm: Avoid tcg_const_ptr in handle_vec_simd_sqshrn, Richard Henderson, 2023/03/09
- [PULL v2 75/91] target/arm: Avoid tcg_const_* in translate-mve.c, Richard Henderson, 2023/03/09
- [PULL v2 76/91] target/arm: Avoid tcg_const_ptr in disas_simd_zip_trn, Richard Henderson, 2023/03/09
- [PULL v2 73/91] target/arm: Improve trans_BFCI, Richard Henderson, 2023/03/09
- [PULL v2 85/91] target/ppc: Avoid tcg_const_* in power8-pmu-regs.c.inc, Richard Henderson, 2023/03/09
- [PULL v2 87/91] target/ppc: Fix gen_tlbsx_booke206, Richard Henderson, 2023/03/09
- [PULL v2 91/91] tcg: Drop tcg_const_*, Richard Henderson, 2023/03/09
- [PULL v2 90/91] tcg: Drop tcg_const_*_vec, Richard Henderson, 2023/03/09
- [PULL v2 89/91] target/tricore: Use min/max for saturate,
Richard Henderson <=
- [PULL v2 88/91] target/ppc: Avoid tcg_const_* in translate.c, Richard Henderson, 2023/03/09
- [PULL v2 86/91] target/ppc: Rewrite trans_ADDG6S, Richard Henderson, 2023/03/09
- [PULL v2 80/91] target/ppc: Avoid tcg_const_i64 in do_vcntmb, Richard Henderson, 2023/03/09
- [PULL v2 81/91] target/ppc: Avoid tcg_const_* in vmx-impl.c.inc, Richard Henderson, 2023/03/09
- [PULL v2 83/91] target/ppc: Avoid tcg_const_* in vsx-impl.c.inc, Richard Henderson, 2023/03/09
- [PULL v2 82/91] target/ppc: Avoid tcg_const_* in xxeval, Richard Henderson, 2023/03/09
- [PULL v2 84/91] target/ppc: Avoid tcg_const_* in fp-impl.c.inc, Richard Henderson, 2023/03/09
- Re: [PULL v2 00/91] tcg patch queue, Peter Maydell, 2023/03/11