Patchwork [4/5] tcg: Add tcg_invert_cond.

login
register
mail settings
Submitter Richard Henderson
Date Dec. 19, 2009, 6:44 p.m.
Message ID <d7e0c1cc054a3b4bcfaf5052b800d3ad453f70e6.1261248772.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/41469/
State New
Headers show

Comments

Richard Henderson - Dec. 19, 2009, 6:44 p.m.
It is very handy to have a reliable mapping of a condition to its inverse.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Aurelien Jarno - Dec. 19, 2009, 11:11 p.m.
On Sat, Dec 19, 2009 at 10:44:52AM -0800, Richard Henderson wrote:
> It is very handy to have a reliable mapping of a condition to its inverse.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>

> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/tcg.h |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 9824493..376d6af 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -205,6 +205,11 @@ typedef enum {
>      TCG_COND_GTU,
>  } TCGCond;
>  
> +static inline TCGCond tcg_invert_cond(TCGCond c)
> +{
> +    return (TCGCond)(c ^ 1);
> +}
> +
>  #define TEMP_VAL_DEAD  0
>  #define TEMP_VAL_REG   1
>  #define TEMP_VAL_MEM   2
> -- 
> 1.6.5.2
> 
> 
> 
>

Patch

diff --git a/tcg/tcg.h b/tcg/tcg.h
index 9824493..376d6af 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -205,6 +205,11 @@  typedef enum {
     TCG_COND_GTU,
 } TCGCond;
 
+static inline TCGCond tcg_invert_cond(TCGCond c)
+{
+    return (TCGCond)(c ^ 1);
+}
+
 #define TEMP_VAL_DEAD  0
 #define TEMP_VAL_REG   1
 #define TEMP_VAL_MEM   2