Patchwork [25/57] target-i386: optimize setbe

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

Comments

Richard Henderson - Jan. 24, 2013, 4:03 a.m.
This is looking at EFLAGS, but it can do so more efficiently with
setcond.

Reviewed-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-i386/translate.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 85be697..2cf668b 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -1055,10 +1055,9 @@  static void gen_setcc_slow(DisasContext *s, int jcc_op, TCGv reg, bool inv)
         break;
     case JCC_BE:
         gen_compute_eflags(s);
-        tcg_gen_shri_tl(reg, cpu_cc_src, 6);
-        tcg_gen_or_tl(reg, reg, cpu_cc_src);
-        tcg_gen_andi_tl(reg, reg, 1);
-        break;
+        tcg_gen_andi_tl(reg, cpu_cc_src, CC_Z | CC_C);
+        tcg_gen_setcondi_tl(inv ? TCG_COND_EQ : TCG_COND_NE, reg, reg, 0);
+        return;
     case JCC_S:
         gen_compute_eflags_s(s, reg, inv);
         inv = false;