diff mbox series

[02/14] target/ppc: Remove redundant MEMOP_GET_SIZE macro

Message ID 20240518093157.407144-3-npiggin@gmail.com
State New
Headers show
Series target/ppc: Various TCG emulation patches | expand

Commit Message

Nicholas Piggin May 18, 2024, 9:31 a.m. UTC
There is a memop_size() function for this.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 target/ppc/translate.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

BALATON Zoltan May 18, 2024, 9:57 a.m. UTC | #1
On Sat, 18 May 2024, Nicholas Piggin wrote:
> There is a memop_size() function for this.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>

> ---
> target/ppc/translate.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 0882fe2fd2..cf2404330b 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -2904,8 +2904,6 @@ static void gen_isync(DisasContext *ctx)
>     ctx->base.is_jmp = DISAS_EXIT_UPDATE;
> }
>
> -#define MEMOP_GET_SIZE(x)  (1 << ((x) & MO_SIZE))
> -
> static void gen_load_locked(DisasContext *ctx, MemOp memop)
> {
>     TCGv gpr = cpu_gpr[rD(ctx->opcode)];
> @@ -2938,7 +2936,7 @@ static void gen_fetch_inc_conditional(DisasContext *ctx, MemOp memop,
>     TCGv u = tcg_temp_new();
>
>     tcg_gen_qemu_ld_tl(t, EA, ctx->mem_idx, memop);
> -    tcg_gen_addi_tl(t2, EA, MEMOP_GET_SIZE(memop));
> +    tcg_gen_addi_tl(t2, EA, memop_size(memop));
>     tcg_gen_qemu_ld_tl(t2, t2, ctx->mem_idx, memop);
>     tcg_gen_addi_tl(u, t, addend);
>
> @@ -2948,7 +2946,7 @@ static void gen_fetch_inc_conditional(DisasContext *ctx, MemOp memop,
>     tcg_gen_qemu_st_tl(u, EA, ctx->mem_idx, memop);
>
>     /* RT = (t != t2 ? t : u = 1<<(s*8-1)) */
> -    tcg_gen_movi_tl(u, 1 << (MEMOP_GET_SIZE(memop) * 8 - 1));
> +    tcg_gen_movi_tl(u, 1 << (memop_size(memop) * 8 - 1));
>     tcg_gen_movcond_tl(cond, cpu_gpr[rD(ctx->opcode)], t, t2, t, u);
> }
>
> @@ -3110,7 +3108,7 @@ static void gen_st_atomic(DisasContext *ctx, MemOp memop)
>             TCGv ea_plus_s = tcg_temp_new();
>
>             tcg_gen_qemu_ld_tl(t, EA, ctx->mem_idx, memop);
> -            tcg_gen_addi_tl(ea_plus_s, EA, MEMOP_GET_SIZE(memop));
> +            tcg_gen_addi_tl(ea_plus_s, EA, memop_size(memop));
>             tcg_gen_qemu_ld_tl(t2, ea_plus_s, ctx->mem_idx, memop);
>             tcg_gen_movcond_tl(TCG_COND_EQ, s, t, t2, src, t);
>             tcg_gen_movcond_tl(TCG_COND_EQ, s2, t, t2, src, t2);
>
Richard Henderson May 18, 2024, 10:59 a.m. UTC | #2
On 5/18/24 11:31, Nicholas Piggin wrote:
> There is a memop_size() function for this.
> 
> Signed-off-by: Nicholas Piggin<npiggin@gmail.com>
> ---
>   target/ppc/translate.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 0882fe2fd2..cf2404330b 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2904,8 +2904,6 @@  static void gen_isync(DisasContext *ctx)
     ctx->base.is_jmp = DISAS_EXIT_UPDATE;
 }
 
-#define MEMOP_GET_SIZE(x)  (1 << ((x) & MO_SIZE))
-
 static void gen_load_locked(DisasContext *ctx, MemOp memop)
 {
     TCGv gpr = cpu_gpr[rD(ctx->opcode)];
@@ -2938,7 +2936,7 @@  static void gen_fetch_inc_conditional(DisasContext *ctx, MemOp memop,
     TCGv u = tcg_temp_new();
 
     tcg_gen_qemu_ld_tl(t, EA, ctx->mem_idx, memop);
-    tcg_gen_addi_tl(t2, EA, MEMOP_GET_SIZE(memop));
+    tcg_gen_addi_tl(t2, EA, memop_size(memop));
     tcg_gen_qemu_ld_tl(t2, t2, ctx->mem_idx, memop);
     tcg_gen_addi_tl(u, t, addend);
 
@@ -2948,7 +2946,7 @@  static void gen_fetch_inc_conditional(DisasContext *ctx, MemOp memop,
     tcg_gen_qemu_st_tl(u, EA, ctx->mem_idx, memop);
 
     /* RT = (t != t2 ? t : u = 1<<(s*8-1)) */
-    tcg_gen_movi_tl(u, 1 << (MEMOP_GET_SIZE(memop) * 8 - 1));
+    tcg_gen_movi_tl(u, 1 << (memop_size(memop) * 8 - 1));
     tcg_gen_movcond_tl(cond, cpu_gpr[rD(ctx->opcode)], t, t2, t, u);
 }
 
@@ -3110,7 +3108,7 @@  static void gen_st_atomic(DisasContext *ctx, MemOp memop)
             TCGv ea_plus_s = tcg_temp_new();
 
             tcg_gen_qemu_ld_tl(t, EA, ctx->mem_idx, memop);
-            tcg_gen_addi_tl(ea_plus_s, EA, MEMOP_GET_SIZE(memop));
+            tcg_gen_addi_tl(ea_plus_s, EA, memop_size(memop));
             tcg_gen_qemu_ld_tl(t2, ea_plus_s, ctx->mem_idx, memop);
             tcg_gen_movcond_tl(TCG_COND_EQ, s, t, t2, src, t);
             tcg_gen_movcond_tl(TCG_COND_EQ, s2, t, t2, src, t2);