From d1e321b82a021c2e86d204af870356bc72b22546 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 24 Sep 2012 14:21:41 -0700 Subject: tcg: Add tcg_high_cond The table that was recently added for hppa is generally usable. And with the renumbering of the TCG_COND constants it's not too difficult to compute rather than have a table. Signed-off-by: Richard Henderson Signed-off-by: Aurelien Jarno --- tcg/tcg.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tcg/tcg.h') diff --git a/tcg/tcg.h b/tcg/tcg.h index 75f0239709..562f0adcd4 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -302,16 +302,33 @@ static inline TCGCond tcg_swap_cond(TCGCond c) return c & 6 ? (TCGCond)(c ^ 9) : c; } +/* Create an "unsigned" version of a "signed" comparison. */ static inline TCGCond tcg_unsigned_cond(TCGCond c) { return c & 2 ? (TCGCond)(c ^ 6) : c; } +/* Must a comparison be considered unsigned? */ static inline bool is_unsigned_cond(TCGCond c) { return (c & 4) != 0; } +/* Create a "high" version of a double-word comparison. + This removes equality from a LTE or GTE comparison. */ +static inline TCGCond tcg_high_cond(TCGCond c) +{ + switch (c) { + case TCG_COND_GE: + case TCG_COND_LE: + case TCG_COND_GEU: + case TCG_COND_LEU: + return (TCGCond)(c ^ 8); + default: + return c; + } +} + #define TEMP_VAL_DEAD 0 #define TEMP_VAL_REG 1 #define TEMP_VAL_MEM 2 -- cgit v1.2.3