Patchwork [11/23] target-sparc: Use DisasCompare in Tcc

login
register
mail settings
Submitter Richard Henderson
Date Oct. 5, 2012, 11:54 p.m.
Message ID <1349481310-9237-12-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/189655/
State New
Headers show

Comments

Richard Henderson - Oct. 5, 2012, 11:54 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-sparc/translate.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

Patch

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index d61a9a0..fa9a057 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -2613,25 +2613,28 @@  static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
                     gen_helper_raise_exception(cpu_env, cpu_tmp32);
 
                 } else if (cond != 0) {
-                    TCGv r_cond = tcg_temp_new();
+                    DisasCompare cmp;
                     int l1;
 #ifdef TARGET_SPARC64
                     /* V9 icc/xcc */
                     int cc = GET_FIELD_SP(insn, 11, 12);
 
                     save_state(dc);
-                    if (cc == 0)
-                        gen_cond(r_cond, 0, cond, dc);
-                    else if (cc == 2)
-                        gen_cond(r_cond, 1, cond, dc);
-                    else
+                    if (cc == 0) {
+                        gen_compare(&cmp, 0, cond, dc);
+                    } else if (cc == 2) {
+                        gen_compare(&cmp, 1, cond, dc);
+                    } else {
                         goto illegal_insn;
+                    }
 #else
                     save_state(dc);
-                    gen_cond(r_cond, 0, cond, dc);
+                    gen_compare(&cmp, 0, cond, dc);
 #endif
                     l1 = gen_new_label();
-                    tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1);
+                    tcg_gen_brcond_tl(tcg_invert_cond(cmp.cond),
+                                      cmp.c1, cmp.c2, l1);
+                    free_compare(&cmp);
 
                     if ((dc->def->features & CPU_FEATURE_HYPV) &&
                         supervisor(dc))
@@ -2643,7 +2646,6 @@  static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
                     gen_helper_raise_exception(cpu_env, cpu_tmp32);
 
                     gen_set_label(l1);
-                    tcg_temp_free(r_cond);
                 }
                 gen_op_next_insn();
                 tcg_gen_exit_tb(0);