Skip to contentSkip to conversation

fix evsrwu and others for powerpcspe

Qemu-trivial [email protected] 4 participants 4 messages Dec 26, 2017 – Feb 10, 2018

lore
Share & tools
lore
#0 lore raw

GEN_SPEOP_ARITH2 declares non-local temporaries then calls gen_op_evsrwu/evsrws/evslw which generates branch insn.

ppc/translate/spe-impl.inc.c renamed from ppc/translate/spe-impl.inc.c.orig +2 -2
@@ -158,8 +158,8 @@
         gen_exception(ctx, POWERPC_EXCP_SPEU);                                \
         return;                                                               \
     }                                                                         \
-    t0 = tcg_temp_new_i32();                                                  \
-    t1 = tcg_temp_new_i32();                                                  \
+    t0 = tcg_temp_local_new_i32();                                                  \
+    t1 = tcg_temp_local_new_i32();                                                  \
                                                                               \
     tcg_gen_trunc_tl_i32(t0, cpu_gpr[rA(ctx->opcode)]);                       \
     tcg_gen_trunc_tl_i32(t1, cpu_gpr[rB(ctx->opcode)]);                       \
#1 lore raw
Quoted 1 line · 26.12.2017 14:29, [email protected] wrote:

GEN_SPEOP_ARITH2 declares non-local temporaries then calls gen_op_evsrwu/evsrws/evslw which generates branch insn.

I'm Cc'ing qemu-devel@ for review, since I don't know much about how ppc works.

Thanks,

/mjt

Quoted 15 lines
ppc/translate/spe-impl.inc.c renamed from ppc/translate/spe-impl.inc.c.orig +2 -2
@@ -158,8 +158,8 @@
         gen_exception(ctx, POWERPC_EXCP_SPEU);                                \
         return;                                                               \
     }                                                                         \
-    t0 = tcg_temp_new_i32();                                                  \
-    t1 = tcg_temp_new_i32();                                                  \
+    t0 = tcg_temp_local_new_i32();                                                  \
+    t1 = tcg_temp_local_new_i32();                                                  \
                                                                               \
     tcg_gen_trunc_tl_i32(t0, cpu_gpr[rA(ctx->opcode)]);                       \
     tcg_gen_trunc_tl_i32(t1, cpu_gpr[rB(ctx->opcode)]);                       \
#2 lore raw
Quoted 4 lines · Michael Tokarev
Quoted 1 line · 26.12.2017 14:29, [email protected] wrote:

GEN_SPEOP_ARITH2 declares non-local temporaries then calls gen_op_evsrwu/evsrws/evslw which generates branch insn.

I'm Cc'ing qemu-devel@ for review, since I don't know much about how ppc works.

For PPC related stuff, please also always send a CC: to [email protected] (or even better, use the scripts/get_maintainer.pl script to get the CC: list right).

Also, your patch is missing a proper "Signed-off-by" line. Please have a look at https://wiki.qemu.org/Contribute/SubmitAPatch for details.

Thanks,
Thomas

Quoted 18 lines
Quoted 16 lines
ppc/translate/spe-impl.inc.c renamed from ppc/translate/spe-impl.inc.c.orig +2 -2
@@ -158,8 +158,8 @@
         gen_exception(ctx, POWERPC_EXCP_SPEU);                                \
         return;                                                               \
     }                                                                         \
-    t0 = tcg_temp_new_i32();                                                  \
-    t1 = tcg_temp_new_i32();                                                  \
+    t0 = tcg_temp_local_new_i32();                                                  \
+    t1 = tcg_temp_local_new_i32();                                                  \
                                                                               \
     tcg_gen_trunc_tl_i32(t0, cpu_gpr[rA(ctx->opcode)]);                       \
     tcg_gen_trunc_tl_i32(t1, cpu_gpr[rB(ctx->opcode)]);                       \
#3 lore raw
In reply to Michael Tokarev
Quoted 9 lines · Michael Tokarev
Quoted 1 line · 26.12.2017 14:29, [email protected] wrote:

GEN_SPEOP_ARITH2 declares non-local temporaries then calls gen_op_evsrwu/evsrws/evslw which generates branch insn.

I'm Cc'ing qemu-devel@ for review, since I don't know much about how ppc works.

Thanks,

/mjt

Quoted 10 lines

ppc/translate/spe-impl.inc.c line 162

Quoted 10 lines
ppc/translate/spe-impl.inc.c renamed from ppc/translate/spe-impl.inc.c.orig +2 -2
@@ -158,8 +158,8 @@
         gen_exception(ctx, POWERPC_EXCP_SPEU);                                \
         return;                                                               \
     }                                                                         \
-    t0 = tcg_temp_new_i32();                                                  \
-    t1 = tcg_temp_new_i32();                                                  \
+    t0 = tcg_temp_local_new_i32();                                                  \
+    t1 = tcg_temp_local_new_i32();                                                  \

While that's one possible solution, it would be better to rewrite the helpers not to use branches. E.g.

    tcg_gen_andi_i32(t0, arg2, 0x1f);
    tcg_gen_andi_i32(t1, arg2, 0x20);
    tcg_gen_shr_i32(ret, arg1, t0);
    tcg_gen_movi_i32(t0, 0);
    tcg_gen_movcond_i32(TCG_COND_NE, ret, t1, t0, t0, ret);

r~