All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: cota@braap.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v7 19/52] tcg: Remove TCGV_EQUAL*
Date: Tue, 24 Oct 2017 00:11:55 -0300	[thread overview]
Message-ID: <55d38c32-ada1-7a7a-0a60-980b3c0b8a7d@amsat.org> (raw)
In-Reply-To: <20171020232023.15010-20-richard.henderson@linaro.org>

On 10/20/2017 08:19 PM, Richard Henderson wrote:
> When we used structures for TCGv_*, we needed a macro in order to
> perform a comparison.  Now that we use pointers, this is just clutter.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/tcg-op.h            | 6 ++----
>  tcg/tcg.h               | 4 ----
>  target/cris/translate.c | 6 +++---
>  target/i386/translate.c | 6 +++---
>  target/m68k/translate.c | 2 +-
>  target/ppc/translate.c  | 4 ++--
>  6 files changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
> index ab2f3c6cee..3129159907 100644
> --- a/tcg/tcg-op.h
> +++ b/tcg/tcg-op.h
> @@ -328,7 +328,7 @@ static inline void tcg_gen_discard_i32(TCGv_i32 arg)
>  
>  static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
>  {
> -    if (!TCGV_EQUAL_I32(ret, arg)) {
> +    if (ret != arg) {
>          tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg);
>      }
>  }
> @@ -522,7 +522,7 @@ static inline void tcg_gen_discard_i64(TCGv_i64 arg)
>  
>  static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg)
>  {
> -    if (!TCGV_EQUAL_I64(ret, arg)) {
> +    if (ret != arg) {
>          tcg_gen_op2_i64(INDEX_op_mov_i64, ret, arg);
>      }
>  }
> @@ -809,7 +809,6 @@ void tcg_gen_lookup_and_goto_ptr(void);
>  #define tcg_temp_free tcg_temp_free_i32
>  #define TCGV_UNUSED(x) TCGV_UNUSED_I32(x)
>  #define TCGV_IS_UNUSED(x) TCGV_IS_UNUSED_I32(x)
> -#define TCGV_EQUAL(a, b) TCGV_EQUAL_I32(a, b)
>  #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i32
>  #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32
>  #else
> @@ -820,7 +819,6 @@ void tcg_gen_lookup_and_goto_ptr(void);
>  #define tcg_temp_free tcg_temp_free_i64
>  #define TCGV_UNUSED(x) TCGV_UNUSED_I64(x)
>  #define TCGV_IS_UNUSED(x) TCGV_IS_UNUSED_I64(x)
> -#define TCGV_EQUAL(a, b) TCGV_EQUAL_I64(a, b)
>  #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i64
>  #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i64
>  #endif
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index b7fac0db8a..8f692bc6cf 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -428,10 +428,6 @@ typedef TCGv_ptr TCGv_env;
>  #error Unhandled TARGET_LONG_BITS value
>  #endif
>  
> -#define TCGV_EQUAL_I32(a, b) ((a) == (b))
> -#define TCGV_EQUAL_I64(a, b) ((a) == (b))
> -#define TCGV_EQUAL_PTR(a, b) ((a) == (b))
> -
>  /* Dummy definition to avoid compiler warnings.  */
>  #define TCGV_UNUSED_I32(x) (x = (TCGv_i32)-1)
>  #define TCGV_UNUSED_I64(x) (x = (TCGv_i64)-1)
> diff --git a/target/cris/translate.c b/target/cris/translate.c
> index 38a999e6f1..55a9202777 100644
> --- a/target/cris/translate.c
> +++ b/target/cris/translate.c
> @@ -839,7 +839,7 @@ static void cris_alu(DisasContext *dc, int op,
>          }
>          tcg_gen_or_tl(d, d, tmp);
>      }
> -    if (!TCGV_EQUAL(tmp, d)) {
> +    if (tmp != d) {
>          tcg_temp_free(tmp);
>      }
>  }
> @@ -1162,7 +1162,7 @@ static inline void t_gen_sext(TCGv d, TCGv s, int size)
>          tcg_gen_ext8s_i32(d, s);
>      } else if (size == 2) {
>          tcg_gen_ext16s_i32(d, s);
> -    } else if (!TCGV_EQUAL(d, s)) {
> +    } else {
>          tcg_gen_mov_tl(d, s);
>      }
>  }
> @@ -1173,7 +1173,7 @@ static inline void t_gen_zext(TCGv d, TCGv s, int size)
>          tcg_gen_ext8u_i32(d, s);
>      } else if (size == 2) {
>          tcg_gen_ext16u_i32(d, s);
> -    } else if (!TCGV_EQUAL(d, s)) {
> +    } else {
>          tcg_gen_mov_tl(d, s);
>      }
>  }
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index 5f24a2de3c..d6697f721c 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -742,7 +742,7 @@ static CCPrepare gen_prepare_eflags_c(DisasContext *s, TCGv reg)
>          size = s->cc_op - CC_OP_SUBB;
>          t1 = gen_ext_tl(cpu_tmp0, cpu_cc_src, size, false);
>          /* If no temporary was used, be careful not to alias t1 and t0.  */
> -        t0 = TCGV_EQUAL(t1, cpu_cc_src) ? cpu_tmp0 : reg;
> +        t0 = t1 == cpu_cc_src ? cpu_tmp0 : reg;

As I noticed in a previous patch, this expression is a bit easier/faster
to read/review with parenthesis are used:

           t0 = (t1 == cpu_cc_src ? cpu_tmp0 : reg);

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>          tcg_gen_mov_tl(t0, cpu_cc_srcT);
>          gen_extu(size, t0);
>          goto add_sub;
> @@ -951,7 +951,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
>              break;
>          case JCC_L:
>              gen_compute_eflags(s);
> -            if (TCGV_EQUAL(reg, cpu_cc_src)) {
> +            if (reg == cpu_cc_src) {
>                  reg = cpu_tmp0;
>              }
>              tcg_gen_shri_tl(reg, cpu_cc_src, 4); /* CC_O -> CC_S */
> @@ -962,7 +962,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
>          default:
>          case JCC_LE:
>              gen_compute_eflags(s);
> -            if (TCGV_EQUAL(reg, cpu_cc_src)) {
> +            if (reg == cpu_cc_src) {
>                  reg = cpu_tmp0;
>              }
>              tcg_gen_shri_tl(reg, cpu_cc_src, 4); /* CC_O -> CC_S */
> diff --git a/target/m68k/translate.c b/target/m68k/translate.c
> index d738f32f9c..63b1552669 100644
> --- a/target/m68k/translate.c
> +++ b/target/m68k/translate.c
> @@ -58,7 +58,7 @@ static TCGv_i64 cpu_macc[4];
>  #define QREG_SP         get_areg(s, 7)
>  
>  static TCGv NULL_QREG;
> -#define IS_NULL_QREG(t) (TCGV_EQUAL(t, NULL_QREG))
> +#define IS_NULL_QREG(t) (t == NULL_QREG)
>  /* Used to distinguish stores from bad addressing modes.  */
>  static TCGv store_dummy;
>  
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index a81ff69d75..616cf8f50e 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -902,7 +902,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1,
>          gen_set_Rc0(ctx, t0);
>      }
>  
> -    if (!TCGV_EQUAL(t0, ret)) {
> +    if (t0 != ret) {
>          tcg_gen_mov_tl(ret, t0);
>          tcg_temp_free(t0);
>      }
> @@ -1438,7 +1438,7 @@ static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1,
>          gen_set_Rc0(ctx, t0);
>      }
>  
> -    if (!TCGV_EQUAL(t0, ret)) {
> +    if (t0 != ret) {
>          tcg_gen_mov_tl(ret, t0);
>          tcg_temp_free(t0);
>      }
> 

  parent reply	other threads:[~2017-10-24  3:12 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 23:19 [Qemu-devel] [PATCH v7 00/52] tcg queued patches Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 01/52] tcg: Merge opcode arguments into TCGOp Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 02/52] tcg: Propagate args to op->args in optimizer Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 03/52] tcg: Propagate args to op->args in tcg.c Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 04/52] tcg: Propagate TCGOp down to allocators Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 05/52] tcg: Introduce arg_temp Richard Henderson
2017-10-24  2:45   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 06/52] tcg: Add temp_global bit to TCGTemp Richard Henderson
2017-10-24  2:49   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 07/52] tcg: Return NULL temp for TCG_CALL_DUMMY_ARG Richard Henderson
2017-10-24  3:09   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 08/52] tcg: Introduce temp_arg, export temp_idx Richard Henderson
2017-10-23 17:09   ` Emilio G. Cota
2017-10-24  2:47   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 09/52] tcg: Use per-temp state data in liveness Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 10/52] tcg: Avoid loops against variable bounds Richard Henderson
2017-10-24  2:51   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 11/52] tcg: Change temp_allocate_frame arg to TCGTemp Richard Henderson
2017-10-24  2:52   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 12/52] tcg: Remove unused TCG_CALL_DUMMY_TCGV Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 13/52] tcg: Use per-temp state data in optimize Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 14/52] tcg: Push tcg_ctx into generator functions Richard Henderson
2017-10-24  2:56   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 15/52] tcg: Push tcg_ctx into tcg_gen_callN Richard Henderson
2017-10-24  2:57   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 16/52] tcg: Introduce tcgv_{i32, i64, ptr}_{arg, temp} Richard Henderson
2017-10-23 17:10   ` Emilio G. Cota
2017-10-24  3:02   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 17/52] tcg: Introduce temp_tcgv_{i32, i64, ptr} Richard Henderson
2017-10-23 17:10   ` Emilio G. Cota
2017-10-24  3:05   ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 18/52] tcg: Remove GET_TCGV_* and MAKE_TCGV_* Richard Henderson
2017-10-23 17:12   ` Emilio G. Cota
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 19/52] tcg: Remove TCGV_EQUAL* Richard Henderson
2017-10-23 17:13   ` Emilio G. Cota
2017-10-24  3:11   ` Philippe Mathieu-Daudé [this message]
2017-10-24 19:56     ` Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 20/52] qom: Introduce CPUClass.tcg_initialize Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 21/52] tcg: Use offsets not indices for TCGv_* Richard Henderson
2017-10-23 17:37   ` Emilio G. Cota
2017-10-24  3:23     ` Philippe Mathieu-Daudé
2017-10-24  3:22   ` Philippe Mathieu-Daudé
2017-10-24  3:30     ` Philippe Mathieu-Daudé
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 22/52] tcg: Use pointers in TCGOp->args Richard Henderson
2017-10-23 17:37   ` Emilio G. Cota
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 23/52] tcg: define CF_PARALLEL and use it for TB hashing along with CF_COUNT_MASK Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 24/52] tcg: Add CPUState cflags_next_tb Richard Henderson
2017-10-23 17:53   ` Emilio G. Cota
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 25/52] tcg: Include CF_COUNT_MASK in CF_HASH_MASK Richard Henderson
2017-10-23 17:53   ` Emilio G. Cota
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 26/52] tcg: convert tb->cflags reads to tb_cflags(tb) Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 27/52] target/arm: check CF_PARALLEL instead of parallel_cpus Richard Henderson
2017-10-20 23:19 ` [Qemu-devel] [PATCH v7 28/52] target/hppa: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 29/52] target/i386: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 30/52] target/m68k: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 31/52] target/s390x: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 32/52] target/sh4: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 33/52] target/sparc: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 34/52] tcg: " Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 35/52] cpu-exec: lookup/generate TB outside exclusive region during step_atomic Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 36/52] tcg: Add CF_LAST_IO + CF_USE_ICOUNT to CF_HASH_MASK Richard Henderson
2017-10-23 17:57   ` Emilio G. Cota
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 37/52] tcg: Remove CF_IGNORE_ICOUNT Richard Henderson
2017-10-23 18:06   ` Emilio G. Cota
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 38/52] translate-all: use a binary search tree to track TBs in TBContext Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 39/52] exec-all: rename tb_free to tb_remove Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 40/52] translate-all: report correct avg host TB size Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 41/52] tcg: take tb_ctx out of TCGContext Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 42/52] tcg: define tcg_init_ctx and make tcg_ctx a pointer Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 43/52] gen-icount: fold exitreq_label into TCGContext Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 44/52] tcg: introduce **tcg_ctxs to keep track of all TCGContext's Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 45/52] tcg: distribute profiling counters across TCGContext's Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 46/52] tcg: allocate optimizer temps with tcg_malloc Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 47/52] osdep: introduce qemu_mprotect_rwx/none Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 48/52] translate-all: use qemu_protect_rwx/none helpers Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 49/52] tcg: introduce regions to split code_gen_buffer Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 50/52] tcg: enable multiple TCG contexts in softmmu Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 51/52] tcg: Initialize cpu_env generically Richard Henderson
2017-10-20 23:20 ` [Qemu-devel] [PATCH v7 52/52] translate-all: exit from tb_phys_invalidate if qht_remove fails Richard Henderson
2017-10-21  0:24 ` [Qemu-devel] [PATCH v7 00/52] tcg queued patches no-reply
2017-10-21 18:43   ` Richard Henderson
2017-10-21  0:44 ` no-reply
2017-10-23 18:14 ` Emilio G. Cota

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=55d38c32-ada1-7a7a-0a60-980b3c0b8a7d@amsat.org \
    --to=f4bug@amsat.org \
    --cc=cota@braap.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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.