Patchwork [26/57] target-i386: optimize setle

login
register
mail settings
Submitter Richard Henderson
Date Jan. 24, 2013, 4:03 a.m.
Message ID <1359000221-19834-27-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/215222/
State New
Headers show

Comments

Richard Henderson - Jan. 24, 2013, 4:03 a.m.
And allow gen_setcc_slow to operate on cpu_cc_src.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-i386/translate.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Patch

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 2cf668b..44cdf62 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -1040,7 +1040,6 @@  static void gen_compute_eflags_z(DisasContext *s, TCGv reg, bool inv)
 
 static void gen_setcc_slow(DisasContext *s, int jcc_op, TCGv reg, bool inv)
 {
-    assert(!TCGV_EQUAL(reg, cpu_cc_src));
     switch(jcc_op) {
     case JCC_O:
         gen_compute_eflags_o(s, reg);
@@ -1067,20 +1066,18 @@  static void gen_setcc_slow(DisasContext *s, int jcc_op, TCGv reg, bool inv)
         break;
     case JCC_L:
         gen_compute_eflags(s);
-        tcg_gen_shri_tl(reg, cpu_cc_src, 11); /* CC_O */
-        tcg_gen_shri_tl(cpu_tmp0, cpu_cc_src, 7); /* CC_S */
+        tcg_gen_shri_tl(cpu_tmp0, cpu_cc_src, 11); /* CC_O */
+        tcg_gen_shri_tl(reg, cpu_cc_src, 7); /* CC_S */
         tcg_gen_xor_tl(reg, reg, cpu_tmp0);
         tcg_gen_andi_tl(reg, reg, 1);
         break;
     default:
     case JCC_LE:
         gen_compute_eflags(s);
-        tcg_gen_shri_tl(reg, cpu_cc_src, 11); /* CC_O */
-        tcg_gen_shri_tl(cpu_tmp4, cpu_cc_src, 7); /* CC_S */
-        tcg_gen_shri_tl(cpu_tmp0, cpu_cc_src, 6); /* CC_Z */
-        tcg_gen_xor_tl(reg, reg, cpu_tmp4);
-        tcg_gen_or_tl(reg, reg, cpu_tmp0);
-        tcg_gen_andi_tl(reg, reg, 1);
+        tcg_gen_shri_tl(cpu_tmp0, cpu_cc_src, 4); /* CC_O -> CC_S */
+        tcg_gen_xor_tl(reg, cpu_tmp0, cpu_cc_src);
+        tcg_gen_andi_tl(reg, reg, CC_S | CC_Z);
+        tcg_gen_setcondi_tl(inv ? TCG_COND_EQ : TCG_COND_NE, reg, reg, 0);
         break;
     }
     if (inv) {