[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 58/70] target/tricore: Use min/max for saturate
From: |
Richard Henderson |
Subject: |
[PATCH 58/70] target/tricore: Use min/max for saturate |
Date: |
Sun, 26 Feb 2023 19:42:21 -1000 |
Use tcg_constant_i32 for the bounds.
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 19cf4b6cc7..d5129f22f5 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -2442,21 +2442,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, ret, tcg_constant_i32(up));
}
static void gen_shi(TCGv ret, TCGv r1, int32_t shift_count)
--
2.34.1
- [PATCH 47/70] target/rx: Use cpu_psw_z as temp in flags computation, (continued)
- [PATCH 47/70] target/rx: Use cpu_psw_z as temp in flags computation, Richard Henderson, 2023/02/27
- [PATCH 48/70] target/rx: Avoid tcg_const_i32 when new temp needed, Richard Henderson, 2023/02/27
- [PATCH 50/70] target/s390x: Split out gen_ri2, Richard Henderson, 2023/02/27
- [PATCH 53/70] target/sh4: Avoid tcg_const_i32, Richard Henderson, 2023/02/27
- [PATCH 54/70] tcg/sparc: Avoid tcg_const_tl in gen_edge, Richard Henderson, 2023/02/27
- [PATCH 51/70] target/s390x: Avoid tcg_const_i64, Richard Henderson, 2023/02/27
- [PATCH 52/70] target/sh4: Avoid tcg_const_i32 for TAS.B, Richard Henderson, 2023/02/27
- [PATCH 55/70] target/sparc: Avoid tcg_const_{tl,i32}, Richard Henderson, 2023/02/27
- [PATCH 56/70] target/tricore: Split t_n as constant from temp as variable, Richard Henderson, 2023/02/27
- [PATCH 58/70] target/tricore: Use min/max for saturate,
Richard Henderson <=
- [PATCH 59/70] target/tricore: Use setcondi instead of explicit allocation, Richard Henderson, 2023/02/27
- [PATCH 60/70] target/tricore: Drop some temp initialization, Richard Henderson, 2023/02/27
- [PATCH 57/70] target/tricore: Rename t_off10 and use tcg_constant_i32, Richard Henderson, 2023/02/27
- [PATCH 62/70] target/xtensa: Tidy translate_bb, Richard Henderson, 2023/02/27
- [PATCH 63/70] target/xtensa: Tidy translate_clamps, Richard Henderson, 2023/02/27
- [PATCH 64/70] target/xtensa: Avoid tcg_const_i32 in translate_l32r, Richard Henderson, 2023/02/27