Patchwork [16/22] tcg-i386: Tidy setcc.

login
register
mail settings
Submitter Richard Henderson
Date April 14, 2010, 6:07 p.m.
Message ID <d7fa5c2474a9064b04be2c7dc90f764131dbc276.1272479073.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/51205/
State New
Headers show

Comments

Richard Henderson - April 14, 2010, 6:07 p.m.
Define and use OPC_SETCC.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/i386/tcg-target.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Aurelien Jarno - May 21, 2010, 9:40 a.m.
On Wed, Apr 14, 2010 at 11:07:27AM -0700, Richard Henderson wrote:
> Define and use OPC_SETCC.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>

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

> ---
>  tcg/i386/tcg-target.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 27e9e9e..0c1a53a 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -189,6 +189,7 @@ static inline int tcg_target_const_match(tcg_target_long val,
>  #define OPC_PUSH_Iv	(0x68)
>  #define OPC_PUSH_Ib	(0x6a)
>  #define OPC_RET		(0xc3)
> +#define OPC_SETCC	(0x90 | P_EXT)	/* ... plus condition code */
>  #define OPC_SHIFT_1	(0xd1)
>  #define OPC_SHIFT_Ib	(0xc1)
>  #define OPC_SHIFT_cl	(0xd3)
> @@ -600,8 +601,7 @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGArg dest,
>                              TCGArg arg1, TCGArg arg2, int const_arg2)
>  {
>      tcg_out_cmp(s, arg1, arg2, const_arg2);
> -    /* setcc */
> -    tcg_out_modrm(s, 0x90 | tcg_cond_to_jcc[cond] | P_EXT, 0, dest);
> +    tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest);
>      tcg_out_ext8u(s, dest, dest);
>  }
>  
> -- 
> 1.6.6.1
> 
> 
> 
>

Patch

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 27e9e9e..0c1a53a 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -189,6 +189,7 @@  static inline int tcg_target_const_match(tcg_target_long val,
 #define OPC_PUSH_Iv	(0x68)
 #define OPC_PUSH_Ib	(0x6a)
 #define OPC_RET		(0xc3)
+#define OPC_SETCC	(0x90 | P_EXT)	/* ... plus condition code */
 #define OPC_SHIFT_1	(0xd1)
 #define OPC_SHIFT_Ib	(0xc1)
 #define OPC_SHIFT_cl	(0xd3)
@@ -600,8 +601,7 @@  static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGArg dest,
                             TCGArg arg1, TCGArg arg2, int const_arg2)
 {
     tcg_out_cmp(s, arg1, arg2, const_arg2);
-    /* setcc */
-    tcg_out_modrm(s, 0x90 | tcg_cond_to_jcc[cond] | P_EXT, 0, dest);
+    tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest);
     tcg_out_ext8u(s, dest, dest);
 }