[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 55/67] target/rx: Use cpu_psw_z as temp in flags computation
From: |
Richard Henderson |
Subject: |
[PULL 55/67] target/rx: Use cpu_psw_z as temp in flags computation |
Date: |
Tue, 7 Mar 2023 09:58:36 -0800 |
Since PSW_Z = PSW_S, we can move that assignment to the end
and use PSW_Z as a temporary while computing PSW_O.
Use tcg_constant_i32 instead of tcg_const_i32.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/rx/translate.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/target/rx/translate.c b/target/rx/translate.c
index 998e6e0b7e..c47aa26893 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -967,14 +967,13 @@ static bool trans_NEG_rr(DisasContext *ctx, arg_NEG_rr *a)
/* ret = arg1 + arg2 + psw_c */
static void rx_adc(TCGv ret, TCGv arg1, TCGv arg2)
{
- TCGv z;
- z = tcg_const_i32(0);
+ TCGv z = tcg_constant_i32(0);
tcg_gen_add2_i32(cpu_psw_s, cpu_psw_c, arg1, z, cpu_psw_c, z);
tcg_gen_add2_i32(cpu_psw_s, cpu_psw_c, cpu_psw_s, cpu_psw_c, arg2, z);
- tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
tcg_gen_xor_i32(cpu_psw_o, cpu_psw_s, arg1);
- tcg_gen_xor_i32(z, arg1, arg2);
- tcg_gen_andc_i32(cpu_psw_o, cpu_psw_o, z);
+ tcg_gen_xor_i32(cpu_psw_z, arg1, arg2);
+ tcg_gen_andc_i32(cpu_psw_o, cpu_psw_o, cpu_psw_z);
+ tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
tcg_gen_mov_i32(ret, cpu_psw_s);
}
@@ -1006,13 +1005,12 @@ static bool trans_ADC_mr(DisasContext *ctx, arg_ADC_mr
*a)
/* ret = arg1 + arg2 */
static void rx_add(TCGv ret, TCGv arg1, TCGv arg2)
{
- TCGv z;
- z = tcg_const_i32(0);
+ TCGv z = tcg_constant_i32(0);
tcg_gen_add2_i32(cpu_psw_s, cpu_psw_c, arg1, z, arg2, z);
- tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
tcg_gen_xor_i32(cpu_psw_o, cpu_psw_s, arg1);
- tcg_gen_xor_i32(z, arg1, arg2);
- tcg_gen_andc_i32(cpu_psw_o, cpu_psw_o, z);
+ tcg_gen_xor_i32(cpu_psw_z, arg1, arg2);
+ tcg_gen_andc_i32(cpu_psw_o, cpu_psw_o, cpu_psw_z);
+ tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
tcg_gen_mov_i32(ret, cpu_psw_s);
}
@@ -1042,23 +1040,23 @@ static bool trans_ADD_rrr(DisasContext *ctx,
arg_ADD_rrr *a)
/* ret = arg1 - arg2 */
static void rx_sub(TCGv ret, TCGv arg1, TCGv arg2)
{
- TCGv temp;
tcg_gen_sub_i32(cpu_psw_s, arg1, arg2);
- tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
tcg_gen_setcond_i32(TCG_COND_GEU, cpu_psw_c, arg1, arg2);
tcg_gen_xor_i32(cpu_psw_o, cpu_psw_s, arg1);
- temp = tcg_temp_new_i32();
- tcg_gen_xor_i32(temp, arg1, arg2);
- tcg_gen_and_i32(cpu_psw_o, cpu_psw_o, temp);
+ tcg_gen_xor_i32(cpu_psw_z, arg1, arg2);
+ tcg_gen_and_i32(cpu_psw_o, cpu_psw_o, cpu_psw_z);
+ tcg_gen_mov_i32(cpu_psw_z, cpu_psw_s);
/* CMP not required return */
if (ret) {
tcg_gen_mov_i32(ret, cpu_psw_s);
}
}
+
static void rx_cmp(TCGv dummy, TCGv arg1, TCGv arg2)
{
rx_sub(NULL, arg1, arg2);
}
+
/* ret = arg1 - arg2 - !psw_c */
/* -> ret = arg1 + ~arg2 + psw_c */
static void rx_sbb(TCGv ret, TCGv arg1, TCGv arg2)
--
2.34.1
- [PULL 41/67] target/cris: Avoid use of tcg_const_i32 throughout, (continued)
- [PULL 41/67] target/cris: Avoid use of tcg_const_i32 throughout, Richard Henderson, 2023/03/07
- [PULL 43/67] target/hppa: Avoid use of tcg_const_i32 throughout, Richard Henderson, 2023/03/07
- [PULL 42/67] target/hppa: Avoid tcg_const_i64 in trans_fid_f, Richard Henderson, 2023/03/07
- [PULL 45/67] target/m68k: Avoid tcg_const_i32 when modified, Richard Henderson, 2023/03/07
- [PULL 44/67] target/i386: Avoid use of tcg_const_* throughout, Richard Henderson, 2023/03/07
- [PULL 46/67] target/m68k: Avoid tcg_const_i32 in bfop_reg, Richard Henderson, 2023/03/07
- [PULL 48/67] target/mips: Split out gen_lxl, Richard Henderson, 2023/03/07
- [PULL 49/67] target/mips: Split out gen_lxr, Richard Henderson, 2023/03/07
- [PULL 52/67] target/ppc: Split out gen_vx_vmul10, Richard Henderson, 2023/03/07
- [PULL 51/67] target/mips: Avoid tcg_const_* throughout, Richard Henderson, 2023/03/07
- [PULL 55/67] target/rx: Use cpu_psw_z as temp in flags computation,
Richard Henderson <=
- [PULL 50/67] target/mips: Avoid tcg_const_tl in gen_r6_ld, Richard Henderson, 2023/03/07
- [PULL 54/67] target/rx: Use tcg_gen_abs_i32, Richard Henderson, 2023/03/07
- [PULL 56/67] target/rx: Avoid tcg_const_i32 when new temp needed, Richard Henderson, 2023/03/07
- [PULL 47/67] target/m68k: Avoid tcg_const_* throughout, Richard Henderson, 2023/03/07
- [PULL 57/67] target/rx: Avoid tcg_const_i32, Richard Henderson, 2023/03/07
- [PULL 59/67] target/sh4: Avoid tcg_const_i32 for TAS.B, Richard Henderson, 2023/03/07
- [PULL 60/67] target/sh4: Avoid tcg_const_i32, Richard Henderson, 2023/03/07
- [PULL 53/67] target/ppc: Avoid tcg_const_i64 in do_vector_shift_quad, Richard Henderson, 2023/03/07
- [PULL 58/67] target/s390x: Avoid tcg_const_i64, Richard Henderson, 2023/03/07
- [PULL 61/67] tcg/sparc: Avoid tcg_const_tl in gen_edge, Richard Henderson, 2023/03/07