diff mbox

[18/22] tcg-i386: Tidy multiply.

Message ID e5081b0bdc3e2d165f24b23ef61def3cc03282dc.1272479073.git.rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson April 14, 2010, 6:29 p.m. UTC
Define and use OPC_IMUL_GvEv{,Ib,Iz}.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/i386/tcg-target.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Comments

Aurelien Jarno May 21, 2010, 9:41 a.m. UTC | #1
On Wed, Apr 14, 2010 at 11:29:31AM -0700, Richard Henderson wrote:
> Define and use OPC_IMUL_GvEv{,Ib,Iz}.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>

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

> ---
>  tcg/i386/tcg-target.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index c3f3e4d..020faf0 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -184,6 +184,9 @@ static inline int tcg_target_const_match(tcg_target_long val,
>  #define OPC_MOVZWL	(0xb7 | P_EXT)
>  #define OPC_MOVSBL	(0xbe | P_EXT)
>  #define OPC_MOVSWL	(0xbf | P_EXT)
> +#define OPC_IMUL_GvEv	(0xaf | P_EXT)
> +#define OPC_IMUL_GvEvIb	(0x6b)
> +#define OPC_IMUL_GvEvIz	(0x69)
>  #define OPC_POP_r32	(0x58)
>  #define OPC_PUSH_r32	(0x50)
>  #define OPC_PUSH_Iv	(0x68)
> @@ -1178,14 +1181,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
>              int32_t val;
>              val = args[2];
>              if (val == (int8_t)val) {
> -                tcg_out_modrm(s, 0x6b, args[0], args[0]);
> +                tcg_out_modrm(s, OPC_IMUL_GvEvIb, args[0], args[0]);
>                  tcg_out8(s, val);
>              } else {
> -                tcg_out_modrm(s, 0x69, args[0], args[0]);
> +                tcg_out_modrm(s, OPC_IMUL_GvEvIz, args[0], args[0]);
>                  tcg_out32(s, val);
>              }
>          } else {
> -            tcg_out_modrm(s, 0xaf | P_EXT, args[0], args[2]);
> +            tcg_out_modrm(s, OPC_IMUL_GvEv, args[0], args[2]);
>          }
>          break;
>      case INDEX_op_mulu2_i32:
> -- 
> 1.6.6.1
> 
> 
> 
>
diff mbox

Patch

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index c3f3e4d..020faf0 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -184,6 +184,9 @@  static inline int tcg_target_const_match(tcg_target_long val,
 #define OPC_MOVZWL	(0xb7 | P_EXT)
 #define OPC_MOVSBL	(0xbe | P_EXT)
 #define OPC_MOVSWL	(0xbf | P_EXT)
+#define OPC_IMUL_GvEv	(0xaf | P_EXT)
+#define OPC_IMUL_GvEvIb	(0x6b)
+#define OPC_IMUL_GvEvIz	(0x69)
 #define OPC_POP_r32	(0x58)
 #define OPC_PUSH_r32	(0x50)
 #define OPC_PUSH_Iv	(0x68)
@@ -1178,14 +1181,14 @@  static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
             int32_t val;
             val = args[2];
             if (val == (int8_t)val) {
-                tcg_out_modrm(s, 0x6b, args[0], args[0]);
+                tcg_out_modrm(s, OPC_IMUL_GvEvIb, args[0], args[0]);
                 tcg_out8(s, val);
             } else {
-                tcg_out_modrm(s, 0x69, args[0], args[0]);
+                tcg_out_modrm(s, OPC_IMUL_GvEvIz, args[0], args[0]);
                 tcg_out32(s, val);
             }
         } else {
-            tcg_out_modrm(s, 0xaf | P_EXT, args[0], args[2]);
+            tcg_out_modrm(s, OPC_IMUL_GvEv, args[0], args[2]);
         }
         break;
     case INDEX_op_mulu2_i32: