Skip to contentSkip to conversation

target/ppc: Change CR registers from i32 to tl

RFC PATCH In review Nicholas Piggin 3 participants 6 messages Sep 13, 2023

lore
Share & tools
lore
#0 lore raw

cover target/ppc: Change CR registers from i32 to tl

This is a bit of churn so I might leave it for later in the cycle (or defer if we get a lot of other changes) since it's a relatively mechanical change. So don't spend time reviewing details, I'm just wondering about concept and general approach.

I'm not sure the history of why these are 32-bit, maybe better code gen on 32-bit host emulating 64-bit? If so, that shouldn't be so important now that most people use 64-bit systems to develop and test with.

Thanks,
Nick

Nicholas Piggin (3):
target/ppc: Change CR registers from i32 to tl target/ppc: Use FP CR1 update helper more widely target/ppc: Optimise after CR register tl conversion

 target/ppc/cpu.h                             |   2 +-
 target/ppc/cpu_init.c                        |   2 +-
 target/ppc/dfp_helper.c                      |  12 +-
 target/ppc/fpu_helper.c                      |  38 +--
 target/ppc/helper.h                          | 124 +++++-----
 target/ppc/int_helper.c                      |  58 ++---
 target/ppc/machine.c                         |   2 +-
 target/ppc/translate.c                       | 239 +++++++++----------
 target/ppc/translate/fixedpoint-impl.c.inc   |   3 +-
 target/ppc/translate/fp-impl.c.inc           |  31 +--
 target/ppc/translate/spe-impl.c.inc          |  18 +-
 target/ppc/translate/storage-ctrl-impl.c.inc |   4 +-
 target/ppc/translate/vmx-impl.c.inc          |  24 +-
 target/ppc/translate/vsx-impl.c.inc          |   6 +-
 15 files changed, 267 insertions(+), 298 deletions(-)
Signature · 1 line
2.40.1
#4 lore raw

RFC PATCH 3/3 target/ppc: Optimise after CR register tl conversion

After changing CR registers from i32 to tl, a number of places that that previously did type conversion are now redundant moves between variables that can be removed.

---
 target/ppc/translate.c                     | 97 +++++++++-------------
 target/ppc/translate/fixedpoint-impl.c.inc |  3 +-
 target/ppc/translate/fp-impl.c.inc         | 17 +---
 4 files changed, 46 insertions(+), 73 deletions(-)
target/ppc/translate.c +41 -56
index 3472697b30..8fdc3f3546 100644
@@ -1471,21 +1471,18 @@ static opc_handler_t invalid_handler = {
 
 static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf)
 {
-    TCGv t0 = tcg_temp_new();
-    TCGv t1 = tcg_temp_new();
-    TCGv t = tcg_temp_new();
+    TCGv tmp = tcg_temp_new();
+    TCGv cr = cpu_crf[crf];
 
-    tcg_gen_movi_tl(t0, CRF_EQ);
-    tcg_gen_movi_tl(t1, CRF_LT);
+    tcg_gen_movi_tl(cr, CRF_EQ);
+    tcg_gen_movi_tl(tmp, CRF_LT);
     tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU),
-                       t0, arg0, arg1, t1, t0);
-    tcg_gen_movi_tl(t1, CRF_GT);
+                       cr, arg0, arg1, tmp, cr);
+    tcg_gen_movi_tl(tmp, CRF_GT);
     tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU),
-                       t0, arg0, arg1, t1, t0);
+                       cr, arg0, arg1, tmp, cr);
 
-    tcg_gen_mov_tl(t, t0);
-    tcg_gen_mov_tl(cpu_crf[crf], cpu_so);
-    tcg_gen_or_tl(cpu_crf[crf], cpu_crf[crf], t);
+    tcg_gen_or_tl(cr, cr, cpu_so);
 }
 
 static inline void gen_op_cmpi(TCGv arg0, target_ulong arg1, int s, int crf)
@@ -1531,19 +1528,16 @@ static void gen_cmprb(DisasContext *ctx)
     TCGv src2 = tcg_temp_new();
     TCGv src2lo = tcg_temp_new();
     TCGv src2hi = tcg_temp_new();
-    TCGv crf = cpu_crf[crfD(ctx->opcode)];
-
-    tcg_gen_mov_tl(src1, cpu_gpr[rA(ctx->opcode)]);
-    tcg_gen_mov_tl(src2, cpu_gpr[rB(ctx->opcode)]);
+    TCGv cr = cpu_crf[crfD(ctx->opcode)];
 
-    tcg_gen_andi_tl(src1, src1, 0xFF);
-    tcg_gen_ext8u_tl(src2lo, src2);
-    tcg_gen_shri_tl(src2, src2, 8);
+    tcg_gen_andi_tl(src1, cpu_gpr[rA(ctx->opcode)], 0xFF);
+    tcg_gen_ext8u_tl(src2lo, cpu_gpr[rB(ctx->opcode)]);
+    tcg_gen_shri_tl(src2, cpu_gpr[rB(ctx->opcode)], 8);
     tcg_gen_ext8u_tl(src2hi, src2);
 
     tcg_gen_setcond_tl(TCG_COND_LEU, src2lo, src2lo, src1);
     tcg_gen_setcond_tl(TCG_COND_LEU, src2hi, src1, src2hi);
-    tcg_gen_and_tl(crf, src2lo, src2hi);
+    tcg_gen_and_tl(cr, src2lo, src2hi);
 
     if (ctx->opcode & 0x00200000) {
         tcg_gen_shri_tl(src2, src2, 8);
@@ -1553,9 +1547,9 @@ static void gen_cmprb(DisasContext *ctx)
         tcg_gen_setcond_tl(TCG_COND_LEU, src2lo, src2lo, src1);
         tcg_gen_setcond_tl(TCG_COND_LEU, src2hi, src1, src2hi);
         tcg_gen_and_tl(src2lo, src2lo, src2hi);
-        tcg_gen_or_tl(crf, crf, src2lo);
+        tcg_gen_or_tl(cr, cr, src2lo);
     }
-    tcg_gen_shli_tl(crf, crf, CRF_GT_BIT);
+    tcg_gen_shli_tl(cr, cr, CRF_GT_BIT);
 }
 
 #if defined(TARGET_PPC64)
@@ -1572,11 +1566,11 @@ static void gen_isel(DisasContext *ctx)
 {
     uint32_t bi = rC(ctx->opcode);
     uint32_t mask = 0x08 >> (bi & 0x03);
+    TCGv cr = cpu_crf[bi >> 2];
     TCGv t0 = tcg_temp_new();
     TCGv zr;
 
-    tcg_gen_mov_tl(t0, cpu_crf[bi >> 2]);
-    tcg_gen_andi_tl(t0, t0, mask);
+    tcg_gen_andi_tl(t0, cr, mask);
 
     zr = tcg_constant_tl(0);
     tcg_gen_movcond_tl(TCG_COND_NE, cpu_gpr[rD(ctx->opcode)], t0, zr,
@@ -3806,13 +3800,12 @@ static void gen_conditional_store(DisasContext *ctx, MemOp memop)
 {
     TCGLabel *lfail;
     TCGv EA;
-    TCGv cr0;
+    TCGv cr0 = cpu_crf[0];
     TCGv t0;
     int rs = rS(ctx->opcode);
 
     lfail = gen_new_label();
     EA = tcg_temp_new();
-    cr0 = tcg_temp_new();
     t0 = tcg_temp_new();
 
     tcg_gen_mov_tl(cr0, cpu_so);
@@ -3829,7 +3822,6 @@ static void gen_conditional_store(DisasContext *ctx, MemOp memop)
     tcg_gen_or_tl(cr0, cr0, t0);
 
     gen_set_label(lfail);
-    tcg_gen_mov_tl(cpu_crf[0], cr0);
     tcg_gen_movi_tl(cpu_reserve, -1);
 }
 
@@ -3885,7 +3877,7 @@ static void gen_stqcx_(DisasContext *ctx)
 {
     TCGLabel *lfail;
     TCGv EA, t0, t1;
-    TCGv cr0;
+    TCGv cr0 = cpu_crf[0];
     TCGv_i128 cmp, val;
     int rs = rS(ctx->opcode);
 
@@ -3896,7 +3888,6 @@ static void gen_stqcx_(DisasContext *ctx)
 
     lfail = gen_new_label();
     EA = tcg_temp_new();
-    cr0 = tcg_temp_new();
 
     tcg_gen_mov_tl(cr0, cpu_so);
     gen_set_access_type(ctx, ACCESS_RES);
@@ -3928,7 +3919,6 @@ static void gen_stqcx_(DisasContext *ctx)
     tcg_gen_or_tl(cr0, cr0, t0);
 
     gen_set_label(lfail);
-    tcg_gen_mov_tl(cpu_crf[0], cr0);
     tcg_gen_movi_tl(cpu_reserve, -1);
 }
 #endif /* defined(TARGET_PPC64) */
@@ -4680,34 +4670,30 @@ static void gen_mcrxrx(DisasContext *ctx)
 /* mfcr mfocrf */
 static void gen_mfcr(DisasContext *ctx)
 {
+    TCGv dst = cpu_gpr[rD(ctx->opcode)];
     uint32_t crm, crn;
 
     if (likely(ctx->opcode & 0x00100000)) {
         crm = CRM(ctx->opcode);
         if (likely(crm && ((crm & (crm - 1)) == 0))) {
             crn = ctz32(crm);
-            tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_crf[7 - crn]);
-            tcg_gen_shli_tl(cpu_gpr[rD(ctx->opcode)],
-                            cpu_gpr[rD(ctx->opcode)], crn * 4);
+            tcg_gen_shli_tl(dst, cpu_crf[7 - crn], crn * 4);
         }
     } else {
-        TCGv t0 = tcg_temp_new();
-        tcg_gen_mov_tl(t0, cpu_crf[0]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[1]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[2]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[3]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[4]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[5]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[6]);
-        tcg_gen_shli_tl(t0, t0, 4);
-        tcg_gen_or_tl(t0, t0, cpu_crf[7]);
-        tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], t0);
+        tcg_gen_shli_tl(dst, cpu_crf[0], 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[1]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[2]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[3]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[4]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[5]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[6]);
+        tcg_gen_shli_tl(dst, dst, 4);
+        tcg_gen_or_tl(dst, dst, cpu_crf[7]);
     }
 }
 
@@ -4794,23 +4780,22 @@ static void gen_mftb(DisasContext *ctx)
 /* mtcrf mtocrf*/
 static void gen_mtcrf(DisasContext *ctx)
 {
+    TCGv src = cpu_gpr[rS(ctx->opcode)];
     uint32_t crm, crn;
 
     crm = CRM(ctx->opcode);
     if (likely((ctx->opcode & 0x00100000))) {
         if (crm && ((crm & (crm - 1)) == 0)) {
-            TCGv temp = tcg_temp_new();
+            TCGv crf;
             crn = ctz32(crm);
-            tcg_gen_mov_tl(temp, cpu_gpr[rS(ctx->opcode)]);
-            tcg_gen_shri_tl(temp, temp, crn * 4);
-            tcg_gen_andi_tl(cpu_crf[7 - crn], temp, 0xf);
+            crf = cpu_crf[7 - crn];
+            tcg_gen_shri_tl(crf, src, crn * 4);
+            tcg_gen_andi_tl(crf, crf, 0xf);
         }
     } else {
-        TCGv temp = tcg_temp_new();
-        tcg_gen_mov_tl(temp, cpu_gpr[rS(ctx->opcode)]);
         for (crn = 0 ; crn < 8 ; crn++) {
             if (crm & (1 << crn)) {
-                    tcg_gen_shri_tl(cpu_crf[7 - crn], temp, crn * 4);
+                    tcg_gen_shri_tl(cpu_crf[7 - crn], src, crn * 4);
                     tcg_gen_andi_tl(cpu_crf[7 - crn], cpu_crf[7 - crn], 0xf);
             }
         }
target/ppc/translate/fixedpoint-impl.c.inc +1 -2
index 1ad4049df6..17cd3febb9 100644
@@ -344,8 +344,7 @@ static bool do_set_bool_cond(DisasContext *ctx, arg_X_bi *a, bool neg, bool rev)
     TCGv temp = tcg_temp_new();
     TCGv zero = tcg_constant_tl(0);
 
-    tcg_gen_mov_tl(temp, cpu_crf[a->bi >> 2]);
-    tcg_gen_andi_tl(temp, temp, mask);
+    tcg_gen_andi_tl(temp, cpu_crf[a->bi >> 2], mask);
     if (neg) {
         tcg_gen_negsetcond_tl(cond, cpu_gpr[a->rt], temp, zero);
     } else {
target/ppc/translate/fp-impl.c.inc +3 -14
index 9f71c039ce..1d986c26eb 100644
@@ -15,19 +15,10 @@ static inline void gen_compute_fprf_float64(TCGv_i64 arg)
     gen_helper_float_check_status(cpu_env);
 }
 
-#if defined(TARGET_PPC64)
-static void gen_set_cr1_from_fpscr(DisasContext *ctx)
-{
-    TCGv tmp = tcg_temp_new();
-    tcg_gen_mov_tl(tmp, cpu_fpscr);
-    tcg_gen_shri_tl(cpu_crf[1], tmp, FPSCR_OX);
-}
-#else
 static void gen_set_cr1_from_fpscr(DisasContext *ctx)
 {
     tcg_gen_shri_tl(cpu_crf[1], cpu_fpscr, FPSCR_OX);
 }
-#endif
 
 /***                       Floating-Point arithmetic                       ***/
 #define _GEN_FLOAT_ACB(name, op1, op2, set_fprf, type)                        \
@@ -518,7 +509,7 @@ static void gen_fmrgow(DisasContext *ctx)
 /* mcrfs */
 static void gen_mcrfs(DisasContext *ctx)
 {
-    TCGv tmp = tcg_temp_new();
+    TCGv cr = cpu_crf[crfD(ctx->opcode)];
     TCGv_i32 tmask;
     TCGv_i64 tnew_fpscr = tcg_temp_new_i64();
     int bfa;
@@ -532,10 +523,8 @@ static void gen_mcrfs(DisasContext *ctx)
     bfa = crfS(ctx->opcode);
     nibble = 7 - bfa;
     shift = 4 * nibble;
-    tcg_gen_shri_tl(tmp, cpu_fpscr, shift);
-    tcg_gen_mov_tl(cpu_crf[crfD(ctx->opcode)], tmp);
-    tcg_gen_andi_tl(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],
-                     0xf);
+    tcg_gen_shri_tl(cr, cpu_fpscr, shift);
+    tcg_gen_andi_tl(cr, cr, 0xf);
     tcg_gen_extu_tl_i64(tnew_fpscr, cpu_fpscr);
     /* Only the exception bits (including FX) should be cleared if read */
     tcg_gen_andi_i64(tnew_fpscr, tnew_fpscr,
Signature · 1 line
2.40.1
#2 lore raw

RFC PATCH 2/3 target/ppc: Use FP CR1 update helper more widely

In reply to Nicholas Piggin

Several places open-code this FP CR1 update. Move them to call gen_set_cr1_from_fpscr().

FPSCR_OX = 28 so move that to the symbolic constant while we are here.

---
 target/ppc/translate/fp-impl.c.inc | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
target/ppc/translate/fp-impl.c.inc +6 -10
index 4e355cb379..9f71c039ce 100644
@@ -20,12 +20,12 @@ static void gen_set_cr1_from_fpscr(DisasContext *ctx)
 {
     TCGv tmp = tcg_temp_new();
     tcg_gen_mov_tl(tmp, cpu_fpscr);
-    tcg_gen_shri_tl(cpu_crf[1], tmp, 28);
+    tcg_gen_shri_tl(cpu_crf[1], tmp, FPSCR_OX);
 }
 #else
 static void gen_set_cr1_from_fpscr(DisasContext *ctx)
 {
-    tcg_gen_shri_tl(cpu_crf[1], cpu_fpscr, 28);
+    tcg_gen_shri_tl(cpu_crf[1], cpu_fpscr, FPSCR_OX);
 }
 #endif
 
@@ -694,8 +694,7 @@ static void gen_mtfsb0(DisasContext *ctx)
         gen_helper_fpscr_clrbit(cpu_env, tcg_constant_i32(crb));
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        gen_set_cr1_from_fpscr(ctx);
     }
 }
 
@@ -714,8 +713,7 @@ static void gen_mtfsb1(DisasContext *ctx)
         gen_helper_fpscr_setbit(cpu_env, tcg_constant_i32(crb));
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        gen_set_cr1_from_fpscr(ctx);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
@@ -750,8 +748,7 @@ static void gen_mtfsf(DisasContext *ctx)
     get_fpr(t1, rB(ctx->opcode));
     gen_helper_store_fpscr(cpu_env, t1, t0);
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        gen_set_cr1_from_fpscr(ctx);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
@@ -779,8 +776,7 @@ static void gen_mtfsfi(DisasContext *ctx)
     t1 = tcg_constant_i32(1 << sh);
     gen_helper_store_fpscr(cpu_env, t0, t1);
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        gen_set_cr1_from_fpscr(ctx);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
Signature · 1 line
2.40.1
#1 lore raw

RFC PATCH 1/3 target/ppc: Change CR registers from i32 to tl

In reply to Nicholas Piggin

tl is more convenient to work with because it matches most other registers.

Change the type to tl. Keep generated code changes to a minimum with trivial conversions (e.g., tcg_gen_trunc_tl_i32 -> tcg_gen_mov_tl). Optimisation is done with a subsequent change.

---
 target/ppc/cpu.h                             |   2 +-
 target/ppc/cpu_init.c                        |   2 +-
 target/ppc/dfp_helper.c                      |  12 +-
 target/ppc/fpu_helper.c                      |  38 ++--
 target/ppc/helper.h                          | 124 +++++-----
 target/ppc/int_helper.c                      |  58 ++---
 target/ppc/machine.c                         |   2 +-
 target/ppc/translate.c                       | 224 +++++++++----------
 target/ppc/translate/fixedpoint-impl.c.inc   |   2 +-
 target/ppc/translate/fp-impl.c.inc           |  26 +--
 target/ppc/translate/spe-impl.c.inc          |  18 +-
 target/ppc/translate/storage-ctrl-impl.c.inc |   4 +-
 target/ppc/translate/vmx-impl.c.inc          |  24 +-
 target/ppc/translate/vsx-impl.c.inc          |   6 +-
 14 files changed, 271 insertions(+), 271 deletions(-)
target/ppc/cpu.h +1 -1
index 173e4c351a..2cc3622148 100644
@@ -1107,7 +1107,7 @@ struct CPUArchState {
     target_ulong gprh[32]; /* storage for GPR MSB, used by the SPE extension */
     target_ulong lr;
     target_ulong ctr;
-    uint32_t crf[8];       /* condition register */
+    target_ulong crf[8];       /* condition register */
 #if defined(TARGET_PPC64)
     target_ulong cfar;
 #endif
target/ppc/cpu_init.c +1 -1
index 7ab5ee92d9..f94dcf7de6 100644
@@ -7481,7 +7481,7 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     }
     qemu_fprintf(f, "CR ");
     for (i = 0; i < 8; i++)
-        qemu_fprintf(f, "%01x", env->crf[i]);
+        qemu_fprintf(f, "%01x", (uint32_t)env->crf[i]);
     qemu_fprintf(f, "  [");
     for (i = 0; i < 8; i++) {
         char a = '-';
target/ppc/dfp_helper.c +6 -6
index 5967ea07a9..822bb28877 100644
@@ -493,7 +493,7 @@ DFP_HELPER_TAB(DDIV, decNumberDivide, DIV_PPs, 64)
 DFP_HELPER_TAB(DDIVQ, decNumberDivide, DIV_PPs, 128)
 
 #define DFP_HELPER_BF_AB(op, dnop, postprocs, size)                            \
-uint32_t helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b)           \
+target_ulong helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b)       \
 {                                                                              \
     struct PPC_DFP dfp;                                                        \
     dfp_prepare_decimal##size(&dfp, a, b, env);                                \
@@ -525,7 +525,7 @@ DFP_HELPER_BF_AB(DCMPO, decNumberCompare, CMPO_PPs, 64)
 DFP_HELPER_BF_AB(DCMPOQ, decNumberCompare, CMPO_PPs, 128)
 
 #define DFP_HELPER_TSTDC(op, size)                                       \
-uint32_t helper_##op(CPUPPCState *env, ppc_fprp_t *a, uint32_t dcm)      \
+target_ulong helper_##op(CPUPPCState *env, ppc_fprp_t *a, uint32_t dcm)  \
 {                                                                        \
     struct PPC_DFP dfp;                                                  \
     int match = 0;                                                       \
@@ -553,7 +553,7 @@ DFP_HELPER_TSTDC(DTSTDC, 64)
 DFP_HELPER_TSTDC(DTSTDCQ, 128)
 
 #define DFP_HELPER_TSTDG(op, size)                                       \
-uint32_t helper_##op(CPUPPCState *env, ppc_fprp_t *a, uint32_t dcm)      \
+target_ulong helper_##op(CPUPPCState *env, ppc_fprp_t *a, uint32_t dcm)  \
 {                                                                        \
     struct PPC_DFP dfp;                                                  \
     int minexp, maxexp, nzero_digits, nzero_idx, is_negative, is_zero,   \
@@ -608,7 +608,7 @@ DFP_HELPER_TSTDG(DTSTDG, 64)
 DFP_HELPER_TSTDG(DTSTDGQ, 128)
 
 #define DFP_HELPER_TSTEX(op, size)                                       \
-uint32_t helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b)     \
+target_ulong helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b) \
 {                                                                        \
     struct PPC_DFP dfp;                                                  \
     int expa, expb, a_is_special, b_is_special;                          \
@@ -640,7 +640,7 @@ DFP_HELPER_TSTEX(DTSTEX, 64)
 DFP_HELPER_TSTEX(DTSTEXQ, 128)
 
 #define DFP_HELPER_TSTSF(op, size)                                       \
-uint32_t helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b)     \
+target_ulong helper_##op(CPUPPCState *env, ppc_fprp_t *a, ppc_fprp_t *b) \
 {                                                                        \
     struct PPC_DFP dfp;                                                  \
     unsigned k;                                                          \
@@ -677,7 +677,7 @@ DFP_HELPER_TSTSF(DTSTSF, 64)
 DFP_HELPER_TSTSF(DTSTSFQ, 128)
 
 #define DFP_HELPER_TSTSFI(op, size)                                     \
-uint32_t helper_##op(CPUPPCState *env, uint32_t a, ppc_fprp_t *b)       \
+target_ulong helper_##op(CPUPPCState *env, uint32_t a, ppc_fprp_t *b)   \
 {                                                                       \
     struct PPC_DFP dfp;                                                 \
     unsigned uim;                                                       \
target/ppc/fpu_helper.c +19 -19
index 03150a0f10..0612798022 100644
@@ -903,7 +903,7 @@ uint64_t helper_FSEL(uint64_t a, uint64_t b, uint64_t c)
     }
 }
 
-uint32_t helper_ftdiv(uint64_t fra, uint64_t frb)
+target_ulong helper_ftdiv(uint64_t fra, uint64_t frb)
 {
     int fe_flag = 0;
     int fg_flag = 0;
@@ -939,7 +939,7 @@ uint32_t helper_ftdiv(uint64_t fra, uint64_t frb)
     return 0x8 | (fg_flag ? 4 : 0) | (fe_flag ? 2 : 0);
 }
 
-uint32_t helper_ftsqrt(uint64_t frb)
+target_ulong helper_ftsqrt(uint64_t frb)
 {
     int fe_flag = 0;
     int fg_flag = 0;
@@ -1285,7 +1285,7 @@ HELPER_SPE_VECTOR_ARITH(fsmul);
 HELPER_SPE_VECTOR_ARITH(fsdiv);
 
 /* Single-precision floating-point comparisons */
-static inline uint32_t efscmplt(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efscmplt(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     CPU_FloatU u1, u2;
 
@@ -1294,7 +1294,7 @@ static inline uint32_t efscmplt(CPUPPCState *env, uint32_t op1, uint32_t op2)
     return float32_lt(u1.f, u2.f, &env->vec_status) ? 4 : 0;
 }
 
-static inline uint32_t efscmpgt(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efscmpgt(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     CPU_FloatU u1, u2;
 
@@ -1303,7 +1303,7 @@ static inline uint32_t efscmpgt(CPUPPCState *env, uint32_t op1, uint32_t op2)
     return float32_le(u1.f, u2.f, &env->vec_status) ? 0 : 4;
 }
 
-static inline uint32_t efscmpeq(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efscmpeq(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     CPU_FloatU u1, u2;
 
@@ -1312,26 +1312,26 @@ static inline uint32_t efscmpeq(CPUPPCState *env, uint32_t op1, uint32_t op2)
     return float32_eq(u1.f, u2.f, &env->vec_status) ? 4 : 0;
 }
 
-static inline uint32_t efststlt(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efststlt(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     /* XXX: TODO: ignore special values (NaN, infinites, ...) */
     return efscmplt(env, op1, op2);
 }
 
-static inline uint32_t efststgt(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efststgt(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     /* XXX: TODO: ignore special values (NaN, infinites, ...) */
     return efscmpgt(env, op1, op2);
 }
 
-static inline uint32_t efststeq(CPUPPCState *env, uint32_t op1, uint32_t op2)
+static inline target_ulong efststeq(CPUPPCState *env, uint32_t op1, uint32_t op2)
 {
     /* XXX: TODO: ignore special values (NaN, infinites, ...) */
     return efscmpeq(env, op1, op2);
 }
 
 #define HELPER_SINGLE_SPE_CMP(name)                                     \
-    uint32_t helper_e##name(CPUPPCState *env, uint32_t op1, uint32_t op2) \
+    target_ulong helper_e##name(CPUPPCState *env, uint32_t op1, uint32_t op2) \
     {                                                                   \
         return e##name(env, op1, op2);                                  \
     }
@@ -1348,13 +1348,13 @@ HELPER_SINGLE_SPE_CMP(fscmpgt);
 /* efscmpeq */
 HELPER_SINGLE_SPE_CMP(fscmpeq);
 
-static inline uint32_t evcmp_merge(int t0, int t1)
+static inline target_ulong evcmp_merge(int t0, int t1)
 {
     return (t0 << 3) | (t1 << 2) | ((t0 | t1) << 1) | (t0 & t1);
 }
 
 #define HELPER_VECTOR_SPE_CMP(name)                                     \
-    uint32_t helper_ev##name(CPUPPCState *env, uint64_t op1, uint64_t op2) \
+    target_ulong helper_ev##name(CPUPPCState *env, uint64_t op1, uint64_t op2) \
     {                                                                   \
         return evcmp_merge(e##name(env, op1 >> 32, op2 >> 32),          \
                            e##name(env, op1, op2));                     \
@@ -1607,7 +1607,7 @@ uint64_t helper_efddiv(CPUPPCState *env, uint64_t op1, uint64_t op2)
 }
 
 /* Double precision floating point helpers */
-uint32_t helper_efdtstlt(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdtstlt(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     CPU_DoubleU u1, u2;
 
@@ -1616,7 +1616,7 @@ uint32_t helper_efdtstlt(CPUPPCState *env, uint64_t op1, uint64_t op2)
     return float64_lt(u1.d, u2.d, &env->vec_status) ? 4 : 0;
 }
 
-uint32_t helper_efdtstgt(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdtstgt(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     CPU_DoubleU u1, u2;
 
@@ -1625,7 +1625,7 @@ uint32_t helper_efdtstgt(CPUPPCState *env, uint64_t op1, uint64_t op2)
     return float64_le(u1.d, u2.d, &env->vec_status) ? 0 : 4;
 }
 
-uint32_t helper_efdtsteq(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdtsteq(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     CPU_DoubleU u1, u2;
 
@@ -1634,19 +1634,19 @@ uint32_t helper_efdtsteq(CPUPPCState *env, uint64_t op1, uint64_t op2)
     return float64_eq_quiet(u1.d, u2.d, &env->vec_status) ? 4 : 0;
 }
 
-uint32_t helper_efdcmplt(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdcmplt(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     /* XXX: TODO: test special values (NaN, infinites, ...) */
     return helper_efdtstlt(env, op1, op2);
 }
 
-uint32_t helper_efdcmpgt(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdcmpgt(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     /* XXX: TODO: test special values (NaN, infinites, ...) */
     return helper_efdtstgt(env, op1, op2);
 }
 
-uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t op1, uint64_t op2)
+target_ulong helper_efdcmpeq(CPUPPCState *env, uint64_t op1, uint64_t op2)
 {
     /* XXX: TODO: test special values (NaN, infinites, ...) */
     return helper_efdtsteq(env, op1, op2);
@@ -2585,11 +2585,11 @@ VSX_MAX_MINJ(XSMINJDP, 0);
  *   exp   - expected result of comparison
  */
 #define VSX_CMP(op, nels, tp, fld, cmp, svxvc, exp)                       \
-uint32_t helper_##op(CPUPPCState *env, ppc_vsr_t *xt,                     \
+target_ulong helper_##op(CPUPPCState *env, ppc_vsr_t *xt,                 \
                      ppc_vsr_t *xa, ppc_vsr_t *xb)                        \
 {                                                                         \
     ppc_vsr_t t = *xt;                                                    \
-    uint32_t crf6 = 0;                                                    \
+    target_ulong crf6 = 0;                                                \
     int i;                                                                \
     int all_true = 1;                                                     \
     int all_false = 1;                                                    \
target/ppc/helper.h +62 -62

178 lines not on this page · raw message

target/ppc/int_helper.c +29 -29

189 lines not on this page · raw message

target/ppc/machine.c +1 -1
index 68cbdffecd..eef6dffed7 100644
@@ -725,7 +725,7 @@ const VMStateDescription vmstate_ppc_cpu = {
 #if !defined(TARGET_PPC64)
         VMSTATE_UINTTL_ARRAY(env.gprh, PowerPCCPU, 32),
 #endif
-        VMSTATE_UINT32_ARRAY(env.crf, PowerPCCPU, 8),
+        VMSTATE_ARRAY(env.crf, PowerPCCPU, 8, 0, vmstate_info_uint32, target_ulong),
         VMSTATE_UINTTL(env.nip, PowerPCCPU),
 
         /* SPRs */
target/ppc/translate.c +112 -112

396 lines not on this page · raw message

target/ppc/translate/fixedpoint-impl.c.inc +1 -1
index 7ff7e1ec46..1ad4049df6 100644
@@ -344,7 +344,7 @@ static bool do_set_bool_cond(DisasContext *ctx, arg_X_bi *a, bool neg, bool rev)
     TCGv temp = tcg_temp_new();
     TCGv zero = tcg_constant_tl(0);
 
-    tcg_gen_extu_i32_tl(temp, cpu_crf[a->bi >> 2]);
+    tcg_gen_mov_tl(temp, cpu_crf[a->bi >> 2]);
     tcg_gen_andi_tl(temp, temp, mask);
     if (neg) {
         tcg_gen_negsetcond_tl(cond, cpu_gpr[a->rt], temp, zero);
target/ppc/translate/fp-impl.c.inc +13 -13
index 874774eade..4e355cb379 100644
@@ -18,9 +18,9 @@ static inline void gen_compute_fprf_float64(TCGv_i64 arg)
 #if defined(TARGET_PPC64)
 static void gen_set_cr1_from_fpscr(DisasContext *ctx)
 {
-    TCGv_i32 tmp = tcg_temp_new_i32();
-    tcg_gen_trunc_tl_i32(tmp, cpu_fpscr);
-    tcg_gen_shri_i32(cpu_crf[1], tmp, 28);
+    TCGv tmp = tcg_temp_new();
+    tcg_gen_mov_tl(tmp, cpu_fpscr);
+    tcg_gen_shri_tl(cpu_crf[1], tmp, 28);
 }
 #else
 static void gen_set_cr1_from_fpscr(DisasContext *ctx)
@@ -533,8 +533,8 @@ static void gen_mcrfs(DisasContext *ctx)
     nibble = 7 - bfa;
     shift = 4 * nibble;
     tcg_gen_shri_tl(tmp, cpu_fpscr, shift);
-    tcg_gen_trunc_tl_i32(cpu_crf[crfD(ctx->opcode)], tmp);
-    tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],
+    tcg_gen_mov_tl(cpu_crf[crfD(ctx->opcode)], tmp);
+    tcg_gen_andi_tl(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],
                      0xf);
     tcg_gen_extu_tl_i64(tnew_fpscr, cpu_fpscr);
     /* Only the exception bits (including FX) should be cleared if read */
@@ -694,8 +694,8 @@ static void gen_mtfsb0(DisasContext *ctx)
         gen_helper_fpscr_clrbit(cpu_env, tcg_constant_i32(crb));
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_trunc_tl_i32(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_i32(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
+        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
     }
 }
 
@@ -714,8 +714,8 @@ static void gen_mtfsb1(DisasContext *ctx)
         gen_helper_fpscr_setbit(cpu_env, tcg_constant_i32(crb));
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_trunc_tl_i32(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_i32(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
+        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
@@ -750,8 +750,8 @@ static void gen_mtfsf(DisasContext *ctx)
     get_fpr(t1, rB(ctx->opcode));
     gen_helper_store_fpscr(cpu_env, t1, t0);
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_trunc_tl_i32(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_i32(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
+        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
@@ -779,8 +779,8 @@ static void gen_mtfsfi(DisasContext *ctx)
     t1 = tcg_constant_i32(1 << sh);
     gen_helper_store_fpscr(cpu_env, t0, t1);
     if (unlikely(Rc(ctx->opcode) != 0)) {
-        tcg_gen_trunc_tl_i32(cpu_crf[1], cpu_fpscr);
-        tcg_gen_shri_i32(cpu_crf[1], cpu_crf[1], FPSCR_OX);
+        tcg_gen_mov_tl(cpu_crf[1], cpu_fpscr);
+        tcg_gen_shri_tl(cpu_crf[1], cpu_crf[1], FPSCR_OX);
     }
     /* We can raise a deferred exception */
     gen_helper_fpscr_check_status(cpu_env);
target/ppc/translate/spe-impl.c.inc +9 -9
index f4a858487d..a456cadfb5 100644
@@ -269,19 +269,19 @@ static inline void gen_##name(DisasContext *ctx)                              \
                                                                               \
     tcg_gen_brcond_tl(tcg_cond, cpu_gpr[rA(ctx->opcode)],                     \
                        cpu_gpr[rB(ctx->opcode)], l1);                         \
-    tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)], 0);                          \
+    tcg_gen_movi_tl(cpu_crf[crfD(ctx->opcode)], 0);                           \
     tcg_gen_br(l2);                                                           \
     gen_set_label(l1);                                                        \
-    tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)],                              \
+    tcg_gen_movi_tl(cpu_crf[crfD(ctx->opcode)],                               \
                      CRF_CL | CRF_CH_OR_CL | CRF_CH_AND_CL);                  \
     gen_set_label(l2);                                                        \
     tcg_gen_brcond_tl(tcg_cond, cpu_gprh[rA(ctx->opcode)],                    \
                        cpu_gprh[rB(ctx->opcode)], l3);                        \
-    tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],  \
+    tcg_gen_andi_tl(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],   \
                      ~(CRF_CH | CRF_CH_AND_CL));                              \
     tcg_gen_br(l4);                                                           \
     gen_set_label(l3);                                                        \
-    tcg_gen_ori_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],   \
+    tcg_gen_ori_tl(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)],    \
                     CRF_CH | CRF_CH_OR_CL);                                   \
     gen_set_label(l4);                                                        \
 }
@@ -363,17 +363,17 @@ static inline void gen_evsel(DisasContext *ctx)
     TCGLabel *l2 = gen_new_label();
     TCGLabel *l3 = gen_new_label();
     TCGLabel *l4 = gen_new_label();
-    TCGv_i32 t0 = tcg_temp_new_i32();
+    TCGv t0 = tcg_temp_new();
 
-    tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 3);
-    tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l1);
+    tcg_gen_andi_tl(t0, cpu_crf[ctx->opcode & 0x07], 1 << 3);
+    tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1);
     tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]);
     tcg_gen_br(l2);
     gen_set_label(l1);
     tcg_gen_mov_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
     gen_set_label(l2);
-    tcg_gen_andi_i32(t0, cpu_crf[ctx->opcode & 0x07], 1 << 2);
-    tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, l3);
+    tcg_gen_andi_tl(t0, cpu_crf[ctx->opcode & 0x07], 1 << 2);
+    tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l3);
     tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
     tcg_gen_br(l4);
     gen_set_label(l3);
target/ppc/translate/storage-ctrl-impl.c.inc +2 -2
index faa7b04bbc..bd381039e4 100644
@@ -141,9 +141,9 @@ static bool trans_SLBFEE(DisasContext *ctx, arg_SLBFEE *a)
                              cpu_gpr[a->rb]);
     l1 = gen_new_label();
     l2 = gen_new_label();
-    tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so);
+    tcg_gen_mov_tl(cpu_crf[0], cpu_so);
     tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[a->rt], -1, l1);
-    tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ);
+    tcg_gen_ori_tl(cpu_crf[0], cpu_crf[0], CRF_EQ);
     tcg_gen_br(l2);
     gen_set_label(l1);
     tcg_gen_movi_tl(cpu_gpr[a->rt], 0);
target/ppc/translate/vmx-impl.c.inc +12 -12
index 6d7669aabd..48d43e84e9 100644
@@ -1230,7 +1230,7 @@ static void do_vcmp_rc(int vrt)
     tcg_gen_shli_i64(set, set, 3);
 
     tcg_gen_or_i64(tmp, set, clr);
-    tcg_gen_extrl_i64_i32(cpu_crf[6], tmp);
+    tcg_gen_trunc_i64_tl(cpu_crf[6], tmp);
 }
 
 static bool do_vcmp(DisasContext *ctx, arg_VC *a, TCGCond cond, int vece)
@@ -1347,9 +1347,9 @@ static bool trans_VCMPEQUQ(DisasContext *ctx, arg_VC *a)
     set_avr64(a->vrt, t1, false);
 
     if (a->rc) {
-        tcg_gen_extrl_i64_i32(cpu_crf[6], t1);
-        tcg_gen_andi_i32(cpu_crf[6], cpu_crf[6], 0xa);
-        tcg_gen_xori_i32(cpu_crf[6], cpu_crf[6], 0x2);
+        tcg_gen_trunc_i64_tl(cpu_crf[6], t1);
+        tcg_gen_andi_tl(cpu_crf[6], cpu_crf[6], 0xa);
+        tcg_gen_xori_tl(cpu_crf[6], cpu_crf[6], 0x2);
     }
     return true;
 }
@@ -1377,9 +1377,9 @@ static bool do_vcmpgtq(DisasContext *ctx, arg_VC *a, bool sign)
     set_avr64(a->vrt, t1, false);
 
     if (a->rc) {
-        tcg_gen_extrl_i64_i32(cpu_crf[6], t1);
-        tcg_gen_andi_i32(cpu_crf[6], cpu_crf[6], 0xa);
-        tcg_gen_xori_i32(cpu_crf[6], cpu_crf[6], 0x2);
+        tcg_gen_trunc_i64_tl(cpu_crf[6], t1);
+        tcg_gen_andi_tl(cpu_crf[6], cpu_crf[6], 0xa);
+        tcg_gen_xori_tl(cpu_crf[6], cpu_crf[6], 0x2);
     }
     return true;
 }
@@ -1411,15 +1411,15 @@ static bool do_vcmpq(DisasContext *ctx, arg_VX_bf *a, bool sign)
     tcg_gen_brcond_i64(TCG_COND_GTU, vra, vrb, gt);
     tcg_gen_brcond_i64(TCG_COND_LTU, vra, vrb, lt);
 
-    tcg_gen_movi_i32(cpu_crf[a->bf], CRF_EQ);
+    tcg_gen_movi_tl(cpu_crf[a->bf], CRF_EQ);
     tcg_gen_br(done);
 
     gen_set_label(gt);
-    tcg_gen_movi_i32(cpu_crf[a->bf], CRF_GT);
+    tcg_gen_movi_tl(cpu_crf[a->bf], CRF_GT);
     tcg_gen_br(done);
 
     gen_set_label(lt);
-    tcg_gen_movi_i32(cpu_crf[a->bf], CRF_LT);
+    tcg_gen_movi_tl(cpu_crf[a->bf], CRF_LT);
     tcg_gen_br(done);
 
     gen_set_label(done);
@@ -2262,7 +2262,7 @@ TRANS(VCNTMBW, do_vcntmb, MO_32)
 TRANS(VCNTMBD, do_vcntmb, MO_64)
 
 static bool do_vstri(DisasContext *ctx, arg_VX_tb_rc *a,
-                     void (*gen_helper)(TCGv_i32, TCGv_ptr, TCGv_ptr))
+                     void (*gen_helper)(TCGv, TCGv_ptr, TCGv_ptr))
 {
     TCGv_ptr vrt, vrb;
 
@@ -2275,7 +2275,7 @@ static bool do_vstri(DisasContext *ctx, arg_VX_tb_rc *a,
     if (a->rc) {
         gen_helper(cpu_crf[6], vrt, vrb);
     } else {
-        TCGv_i32 discard = tcg_temp_new_i32();
+        TCGv discard = tcg_temp_new();
         gen_helper(discard, vrt, vrb);
     }
     return true;
target/ppc/translate/vsx-impl.c.inc +3 -3
index 0f5b0056f1..3aaf358250 100644
@@ -791,7 +791,7 @@ TRANS(XVCPSGNDP, do_xvcpsgn, MO_64)
 #define VSX_CMP(name, op1, op2, inval, type)                                  \
 static void gen_##name(DisasContext *ctx)                                     \
 {                                                                             \
-    TCGv_i32 ignored;                                                         \
+    TCGv ignored;                                                             \
     TCGv_ptr xt, xa, xb;                                                      \
     if (unlikely(!ctx->vsx_enabled)) {                                        \
         gen_exception(ctx, POWERPC_EXCP_VSXU);                                \
@@ -803,7 +803,7 @@ static void gen_##name(DisasContext *ctx)                                     \
     if ((ctx->opcode >> (31 - 21)) & 1) {                                     \
         gen_helper_##name(cpu_crf[6], cpu_env, xt, xa, xb);                   \
     } else {                                                                  \
-        ignored = tcg_temp_new_i32();                                         \
+        ignored = tcg_temp_new();                                             \
         gen_helper_##name(ignored, cpu_env, xt, xa, xb);                      \
     }                                                                         \
 }
@@ -1808,7 +1808,7 @@ static bool trans_XVTLSBB(DisasContext *ctx, arg_XX2_bf_xb *a)
     tcg_gen_shli_i64(all_true, all_true, 3);
 
     tcg_gen_or_i64(t0, all_false, all_true);
-    tcg_gen_extrl_i64_i32(cpu_crf[a->bf], t0);
+    tcg_gen_trunc_i64_tl(cpu_crf[a->bf], t0);
     return true;
 }
 
Signature · 1 line
2.40.1
Reviewed-by on v1 2/3
#3 lore raw

Re: [RFC PATCH 2/3] target/ppc: Use FP CR1 update helper more widely

In reply to Nicholas Piggin
Quoted 9 lines · Nicholas Piggin

Several places open-code this FP CR1 update. Move them to call gen_set_cr1_from_fpscr().

FPSCR_OX = 28 so move that to the symbolic constant while we are here.

---
  target/ppc/translate/fp-impl.c.inc | 16 ++++++----------
  1 file changed, 6 insertions(+), 10 deletions(-)
#5 lore raw
In reply to Nicholas Piggin
Quoted 8 lines · Nicholas Piggin

This is a bit of churn so I might leave it for later in the cycle (or defer if we get a lot of other changes) since it's a relatively mechanical change. So don't spend time reviewing details, I'm just wondering about concept and general approach.

I'm not sure the history of why these are 32-bit, maybe better code gen on 32-bit host emulating 64-bit? If so, that shouldn't be so important now that most people use 64-bit systems to develop and test with.

It was probably in order to save space, but I have no specific knowledge.

What does this do to the generated code? I suspect, without looking, that it doesn't change things much at all on e.g. a ppc64 host, and for an x86_64 host merely changes the types of some instructions (which, considering the rex64 encoding, might consume a few more bytes).

r~