Patchwork [1/3] tcg: Add is_unsigned_cond

login
register
mail settings
Submitter Richard Henderson
Date Sept. 24, 2012, 9:21 p.m.
Message ID <1348521701-18238-2-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/186567/
State New
Headers show

Comments

Richard Henderson - Sept. 24, 2012, 9:21 p.m.
Before we rearrange the TCG_COND enumeration, add a predicate for
the (single) use of comparisons vs TCGCond.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/s390/tcg-target.c | 2 +-
 tcg/tcg.h             | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Patch

diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 3b90605..6e95eba 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -1113,7 +1113,7 @@  static void tgen64_xori(TCGContext *s, TCGReg dest, tcg_target_ulong val)
 static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
                     TCGArg c2, int c2const)
 {
-    bool is_unsigned = (c > TCG_COND_GT);
+    bool is_unsigned = is_unsigned_cond(c);
     if (c2const) {
         if (c2 == 0) {
             if (type == TCG_TYPE_I32) {
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 48a56f0..120daab 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -298,6 +298,11 @@  static inline TCGCond tcg_unsigned_cond(TCGCond c)
     return (c >= TCG_COND_LT && c <= TCG_COND_GT ? c + 4 : c);
 }
 
+static inline bool is_unsigned_cond(TCGCond c)
+{
+    return c >= TCG_COND_LTU;
+}
+
 #define TEMP_VAL_DEAD  0
 #define TEMP_VAL_REG   1
 #define TEMP_VAL_MEM   2