tcg: more tcg_gen_abs() uses
cover tcg: more tcg_gen_abs() uses
Hi Richard, 2 patches to complete your series.
Based on Richard's "tcg vector improvements" series:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg03430.html
Regards,
Phil.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (2):
target/ppc: Use tcg_gen_abs_i32
target/tricore: Use tcg_gen_abs_tl
target/ppc/translate/spe-impl.inc.c | 14 +------------- target/tricore/translate.c | 27 +++++---------------------- 2 files changed, 6 insertions(+), 35 deletions(-)
Signature · 1 line
2.19.1
PATCH 1/2 target/ppc: Use tcg_gen_abs_i32
--- target/ppc/translate/spe-impl.inc.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
target/ppc/translate/spe-impl.inc.c +1 -13
@@ -125,19 +125,7 @@ static inline void gen_##name(DisasContext *ctx) \tcg_temp_free_i32 (t0); \ } -static inline void gen_op_evabs (TCGv_i32 ret,TCGv_i32 arg1) -{ -TCGLabel *l1 =gen_new_label (); -TCGLabel *l2 =gen_new_label (); - -tcg_gen_brcondi_i32 (TCG_COND_GE , arg1,0 , l1); -tcg_gen_neg_i32 (ret, arg1); -tcg_gen_br (l2); -gen_set_label (l1); -tcg_gen_mov_i32 (ret, arg1); -gen_set_label (l2); -} -GEN_SPEOP_ARITH1 (evabs, gen_op_evabs); +GEN_SPEOP_ARITH1 (evabs, tcg_gen_abs_i32);GEN_SPEOP_ARITH1 (evneg, tcg_gen_neg_i32);GEN_SPEOP_ARITH1 (evextsb, tcg_gen_ext8s_i32);GEN_SPEOP_ARITH1 (evextsh, tcg_gen_ext16s_i32);
Signature · 1 line
2.19.1
PATCH 2/2 target/tricore: Use tcg_gen_abs_tl
In reply to Philippe Mathieu-Daudé--- target/tricore/translate.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
target/tricore/translate.c +5 -22
@@ -2415,11 +2415,7 @@ gen_msubadr32s_h(TCGv ret, TCGv r1, TCGv r2, TCGv r3, uint32_t n, uint32_t mode)static inline void gen_abs (TCGv ret,TCGv r1) { -TCGv temp =tcg_temp_new (); -TCGv t0 =tcg_const_i32 (0 ); - -tcg_gen_neg_tl (temp, r1); -tcg_gen_movcond_tl (TCG_COND_GE , ret, r1, t0, r1, temp); +tcg_gen_abs_tl (ret, r1);/* overflow can only happen, if r1 = 0x80000000 */ tcg_gen_setcondi_tl (TCG_COND_EQ , cpu_PSW_V, r1,0x80000000 );tcg_gen_shli_tl (cpu_PSW_V, cpu_PSW_V,31 );
@@ -2430,9 +2426,6 @@ static inline void gen_abs(TCGv ret, TCGv r1)tcg_gen_xor_tl (cpu_PSW_AV, ret, cpu_PSW_AV);/* calc SAV bit */ tcg_gen_or_tl (cpu_PSW_SAV, cpu_PSW_SAV, cpu_PSW_AV); - -tcg_temp_free (temp); -tcg_temp_free (t0); }static inline void gen_absdif (TCGv ret,TCGv r1,TCGv r2)
@@ -6617,13 +6610,8 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)tcg_gen_movi_tl (cpu_PSW_AV,0 );if (!tricore_feature (env,TRICORE_FEATURE_131 )) {/* overflow = (abs(D[r3+1]) >= abs(D[r2])) */ -tcg_gen_neg_tl (temp, temp3); -/* use cpu_PSW_AV to compare against 0 */ -tcg_gen_movcond_tl (TCG_COND_LT , temp, temp3, cpu_PSW_AV, - temp, temp3); -tcg_gen_neg_tl (temp2, cpu_gpr_d[r2]); -tcg_gen_movcond_tl (TCG_COND_LT , temp2, cpu_gpr_d[r2], cpu_PSW_AV, - temp2, cpu_gpr_d[r2]); +tcg_gen_abs_tl (temp, temp3); +tcg_gen_abs_tl (temp2, cpu_gpr_d[r2]);tcg_gen_setcond_tl (TCG_COND_GE , cpu_PSW_V, temp, temp2); }else {/* overflow = (D[b] == 0) */
@@ -6655,13 +6643,8 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)tcg_gen_movi_tl (cpu_PSW_AV,0 );if (!tricore_feature (env,TRICORE_FEATURE_131 )) {/* overflow = (abs(D[r3+1]) >= abs(D[r2])) */ -tcg_gen_neg_tl (temp, temp3); -/* use cpu_PSW_AV to compare against 0 */ -tcg_gen_movcond_tl (TCG_COND_LT , temp, temp3, cpu_PSW_AV, - temp, temp3); -tcg_gen_neg_tl (temp2, cpu_gpr_d[r2]); -tcg_gen_movcond_tl (TCG_COND_LT , temp2, cpu_gpr_d[r2], cpu_PSW_AV, - temp2, cpu_gpr_d[r2]); +tcg_gen_abs_tl (temp, temp3); +tcg_gen_abs_tl (temp2, cpu_gpr_d[r2]);tcg_gen_setcond_tl (TCG_COND_GE , cpu_PSW_V, temp, temp2); }else {/* overflow = (D[b] == 0) */
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH 2/2] target/tricore: Use tcg_gen_abs_tl
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/tricore/translate.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
Cheers,
Bastian
Quoted 10 lines · Philippe Mathieu-Daudé
Hi Richard, 2 patches to complete your series.
Based on Richard's "tcg vector improvements" series:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg03430.htmlRegards,
Phil.
Based-on: <[email protected]>
Thanks! It's hard to track down all uses like this. ;-)
r~
Richard Henderson
AppliedQuoted 3 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (2):
target/ppc: Usetcg_gen_abs_i32
target/tricore: Usetcg_gen_abs_tl
Queued onto tcg-vec-next.
r~