All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] tcg-x86_64: Implement setcond.
Date: Sun, 20 Dec 2009 00:11:25 +0100	[thread overview]
Message-ID: <20091219231125.GA319@volta.aurel32.net> (raw)
In-Reply-To: <bdecce6de6593693b46b66487b1f772d79744472.1261248772.git.rth@twiddle.net>

On Sat, Dec 19, 2009 at 08:50:19AM -0800, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>

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

> ---
>  tcg/x86_64/tcg-target.c |   38 +++++++++++++++++++++++++++++++++-----
>  1 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c
> index 2339091..33dc452 100644
> --- a/tcg/x86_64/tcg-target.c
> +++ b/tcg/x86_64/tcg-target.c
> @@ -491,26 +491,42 @@ static void tcg_out_jxx(TCGContext *s, int opc, int label_index)
>      }
>  }
>  
> -static void tcg_out_brcond(TCGContext *s, int cond, 
> -                           TCGArg arg1, TCGArg arg2, int const_arg2,
> -                           int label_index, int rexw)
> +static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2,
> +                        int const_arg2, int rexw)
>  {
>      if (const_arg2) {
>          if (arg2 == 0) {
>              /* test r, r */
>              tcg_out_modrm(s, 0x85 | rexw, arg1, arg1);
>          } else {
> -            if (rexw)
> +            if (rexw) {
>                  tgen_arithi64(s, ARITH_CMP, arg1, arg2);
> -            else
> +            } else {
>                  tgen_arithi32(s, ARITH_CMP, arg1, arg2);
> +            }
>          }
>      } else {
>          tcg_out_modrm(s, 0x01 | (ARITH_CMP << 3) | rexw, arg2, arg1);
>      }
> +}
> +
> +static void tcg_out_brcond(TCGContext *s, int cond,
> +                           TCGArg arg1, TCGArg arg2, int const_arg2,
> +                           int label_index, int rexw)
> +{
> +    tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);
>      tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index);
>  }
>  
> +static void tcg_out_setcond(TCGContext *s, int cond, TCGArg dest,
> +                            TCGArg arg1, TCGArg arg2, int const_arg2, int rexw)
> +{
> +    tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);
> +    /* setcc */
> +    tcg_out_modrm(s, 0x90 | tcg_cond_to_jcc[cond] | P_EXT | P_REXB, 0, dest);
> +    tgen_arithi32(s, ARITH_AND, dest, 0xff);
> +}
> +
>  #if defined(CONFIG_SOFTMMU)
>  
>  #include "../../softmmu_defs.h"
> @@ -1197,6 +1213,15 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
>          tcg_out_modrm(s, 0x8b, args[0], args[1]);
>          break;
>  
> +    case INDEX_op_setcond_i32:
> +        tcg_out_setcond(s, args[3], args[0], args[1], args[2],
> +                        const_args[2], 0);
> +        break;
> +    case INDEX_op_setcond_i64:
> +        tcg_out_setcond(s, args[3], args[0], args[1], args[2],
> +                        const_args[2], P_REXW);
> +        break;
> +
>      case INDEX_op_qemu_ld8u:
>          tcg_out_qemu_ld(s, args, 0);
>          break;
> @@ -1376,6 +1401,9 @@ static const TCGTargetOpDef x86_64_op_defs[] = {
>      { INDEX_op_ext16u_i64, { "r", "r"} },
>      { INDEX_op_ext32u_i64, { "r", "r"} },
>  
> +    { INDEX_op_setcond_i32, { "r", "r", "ri" } },
> +    { INDEX_op_setcond_i64, { "r", "r", "re" } },
> +
>      { INDEX_op_qemu_ld8u, { "r", "L" } },
>      { INDEX_op_qemu_ld8s, { "r", "L" } },
>      { INDEX_op_qemu_ld16u, { "r", "L" } },
> -- 
> 1.6.5.2
> 
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2009-12-19 23:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-19 18:52 [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4 Richard Henderson
2009-12-19 16:50 ` [Qemu-devel] [PATCH 2/5] tcg-x86_64: Implement setcond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno [this message]
2009-12-19 18:01 ` [Qemu-devel] [PATCH 1/5] tcg: Generic support for conditional set Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 23:24     ` Richard Henderson
2009-12-19 23:45       ` Aurelien Jarno
2009-12-22 11:27   ` Laurent Desnogues
2009-12-22 16:09     ` Richard Henderson
2009-12-19 18:44 ` [Qemu-devel] [PATCH 3/5] tcg-i386: Implement small forward branches Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 23:32   ` Laurent Desnogues
2009-12-20  1:17     ` Richard Henderson
2009-12-19 18:44 ` [Qemu-devel] [PATCH 4/5] tcg: Add tcg_invert_cond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 18:46 ` [Qemu-devel] [PATCH 5/5] tcg-i386: Implement setcond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-22 12:20     ` Laurent Desnogues
2009-12-19 23:11 ` [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4 Aurelien Jarno
2009-12-19 23:43   ` malc
2009-12-20 11:03     ` Blue Swirl
2009-12-20 22:57 ` Paul Brook
2009-12-21  2:00   ` Richard Henderson
2009-12-21  9:13     ` Laurent Desnogues
2009-12-21  9:47       ` [Qemu-devel] " Paolo Bonzini
2009-12-21 10:03         ` Laurent Desnogues
2009-12-21 20:28       ` [Qemu-devel] " Richard Henderson
2009-12-21 22:21         ` Laurent Desnogues
2009-12-21 22:50           ` Richard Henderson
2009-12-21 23:08             ` Laurent Desnogues
2009-12-22  0:02               ` Richard Henderson
2009-12-22 14:46                 ` Laurent Desnogues
2009-12-22  7:19         ` Aurelien Jarno
2009-12-21 10:08     ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091219231125.GA319@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.