Skip to contentSkip to conversation

tcg/ppc64: AREG0 support

PATCH In review Andreas Färber 2 participants 6 messages May 12, 2012 – May 14, 2012

lore
Share & tools
lore
#0 lore raw

cover tcg/ppc64: AREG0 support

Hello malc and Alex,

Here's patches to optimize and fix potential AREG0 issues on ppc64.

So far I've only tested on Darwin/ppc64 - Debian/sparc, HelenOS/sparc64, Haiku/i386, Haiku/x86_64 guests work.
Still TODO: testing on Linux and testing AREG0 ppc(64).

Regards,
Andreas

Cc Alexander Graf <[email protected]>

Andreas Färber (2):
tcg/ppc64: Don't hardcode register numbers for qemu_ld/st tcg/ppc64: Fix CONFIG_TCG_PASS_AREG0

 tcg/ppc64/tcg-target.c |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)
Signature · 1 line
1.7.7
#1 lore raw

PATCH 1/2 tcg/ppc64: Don't hardcode register numbers for qemu_ld/st

Facilitates using r3 for prepended AREG0.

---
 tcg/ppc64/tcg-target.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
tcg/ppc64/tcg-target.c +9 -7
index d0b067b..0573a72 100644
@@ -642,7 +642,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
 {
     int addr_reg, data_reg, r0, r1, rbase, bswap;
 #ifdef CONFIG_SOFTMMU
-    int r2, mem_index, s_bits;
+    int r2, mem_index, s_bits, ir;
     void *label1_ptr, *label2_ptr;
 #endif
 
@@ -669,8 +669,9 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
 #endif
 
     /* slow path */
-    tcg_out_mov (s, TCG_TYPE_I64, 3, addr_reg);
-    tcg_out_movi (s, TCG_TYPE_I64, 4, mem_index);
+    ir = 3;
+    tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg);
+    tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index);
 
 #ifdef CONFIG_TCG_PASS_AREG0
     /* XXX/FIXME: suboptimal */
@@ -799,7 +800,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 {
     int addr_reg, r0, r1, rbase, data_reg, bswap;
 #ifdef CONFIG_SOFTMMU
-    int r2, mem_index;
+    int r2, mem_index, ir;
     void *label1_ptr, *label2_ptr;
 #endif
 
@@ -825,9 +826,10 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 #endif
 
     /* slow path */
-    tcg_out_mov (s, TCG_TYPE_I64, 3, addr_reg);
-    tcg_out_rld (s, RLDICL, 4, data_reg, 0, 64 - (1 << (3 + opc)));
-    tcg_out_movi (s, TCG_TYPE_I64, 5, mem_index);
+    ir = 3;
+    tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg);
+    tcg_out_rld (s, RLDICL, ir++, data_reg, 0, 64 - (1 << (3 + opc)));
+    tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index);
 
 #ifdef CONFIG_TCG_PASS_AREG0
     /* XXX/FIXME: suboptimal */
Signature · 1 line
1.7.7
#2 lore raw

PATCH 2/2 tcg/ppc64: Fix CONFIG_TCG_PASS_AREG0

In reply to Andreas Färber

In qemu_ld/st load the registers for the helper calls directly rather than rotating them around afterwards for AREG0.

Also clobber the additional register.

---
 tcg/ppc64/tcg-target.c |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)
tcg/ppc64/tcg-target.c +12 -20
index 0573a72..c800574 100644
@@ -235,6 +235,9 @@ static int target_parse_constraint (TCGArgConstraint *ct, const char **pct_str)
         tcg_regset_reset_reg (ct->u.regs, TCG_REG_R3);
 #ifdef CONFIG_SOFTMMU
         tcg_regset_reset_reg (ct->u.regs, TCG_REG_R4);
+#ifdef CONFIG_TCG_PASS_AREG0
+        tcg_regset_reset_reg (ct->u.regs, TCG_REG_R5);
+#endif
 #endif
         break;
     case 'S':                   /* qemu_st constraint */
@@ -244,6 +247,9 @@ static int target_parse_constraint (TCGArgConstraint *ct, const char **pct_str)
 #ifdef CONFIG_SOFTMMU
         tcg_regset_reset_reg (ct->u.regs, TCG_REG_R4);
         tcg_regset_reset_reg (ct->u.regs, TCG_REG_R5);
+#ifdef CONFIG_TCG_PASS_AREG0
+        tcg_regset_reset_reg (ct->u.regs, TCG_REG_R6);
+#endif
 #endif
         break;
     case 'Z':
@@ -670,18 +676,12 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
 
     /* slow path */
     ir = 3;
+#ifdef CONFIG_TCG_PASS_AREG0
+    tcg_out_mov (s, TCG_TYPE_I64, ir++, TCG_AREG0);
+#endif
     tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg);
     tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index);
 
-#ifdef CONFIG_TCG_PASS_AREG0
-    /* XXX/FIXME: suboptimal */
-    tcg_out_mov (s, TCG_TYPE_I32, tcg_target_call_iarg_regs[2],
-                 tcg_target_call_iarg_regs[1]);
-    tcg_out_mov (s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1],
-                 tcg_target_call_iarg_regs[0]);
-    tcg_out_mov (s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0],
-                 TCG_AREG0);
-#endif
     tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1);
 
     switch (opc) {
@@ -827,21 +827,13 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 
     /* slow path */
     ir = 3;
+#ifdef CONFIG_TCG_PASS_AREG0
+    tcg_out_mov (s, TCG_TYPE_I64, ir++, TCG_AREG0);
+#endif
     tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg);
     tcg_out_rld (s, RLDICL, ir++, data_reg, 0, 64 - (1 << (3 + opc)));
     tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index);
 
-#ifdef CONFIG_TCG_PASS_AREG0
-    /* XXX/FIXME: suboptimal */
-    tcg_out_mov (s, TCG_TYPE_I32, tcg_target_call_iarg_regs[3],
-                 tcg_target_call_iarg_regs[2]);
-    tcg_out_mov (s, TCG_TYPE_I64, tcg_target_call_iarg_regs[2],
-                 tcg_target_call_iarg_regs[1]);
-    tcg_out_mov (s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1],
-                 tcg_target_call_iarg_regs[0]);
-    tcg_out_mov (s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0],
-                 TCG_AREG0);
-#endif
     tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1);
 
     label2_ptr = s->code_ptr;
Signature · 1 line
1.7.7
#3 lore raw
In reply to Andreas Färber
Quoted 8 lines · Andreas F?rber

Hello malc and Alex,

Here's patches to optimize and fix potential AREG0 issues on ppc64.

So far I've only tested on Darwin/ppc64 - Debian/sparc, HelenOS/sparc64, Haiku/i386, Haiku/x86_64 guests work.
Still TODO: testing on Linux and testing AREG0 ppc(64).

Okay with me once TODO is done.

Quoted 14 lines

Regards,
Andreas

Cc Alexander Graf <[email protected]>

Andreas F?rber (2):
tcg/ppc64: Don't hardcode register numbers for qemu_ld/st tcg/ppc64: Fix CONFIG_TCG_PASS_AREG0

 tcg/ppc64/tcg-target.c |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)
Signature · 1 line
mailto:[email protected]
#4 lore raw
In reply to Andreas Färber

Am 12.05.2012 03:16, schrieb Andreas Färber:

Quoted 4 lines

Here's patches to optimize and fix potential AREG0 issues on ppc64.

So far I've only tested on Darwin/ppc64 - Debian/sparc, HelenOS/sparc64, Haiku/i386, Haiku/x86_64 guests work.

I've now tested SLES/ppc64 (backported to agraf's AREG0 branch) and SLES/i386 (without Blue's x86 patches) on Linux/ppc64, i.e. one with, one without AREG0. Please apply.

Andreas

Quoted 6 lines

Andreas Färber (2):
tcg/ppc64: Don't hardcode register numbers for qemu_ld/st tcg/ppc64: Fix CONFIG_TCG_PASS_AREG0

 tcg/ppc64/tcg-target.c |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
Quoted 9 lines · Andreas F?rber

Am 12.05.2012 03:16, schrieb Andreas F?rber:

Quoted 4 lines

Here's patches to optimize and fix potential AREG0 issues on ppc64.

So far I've only tested on Darwin/ppc64 - Debian/sparc, HelenOS/sparc64, Haiku/i386, Haiku/x86_64 guests work.

I've now tested SLES/ppc64 (backported to agraf's AREG0 branch) and SLES/i386 (without Blue's x86 patches) on Linux/ppc64, i.e. one with, one without AREG0. Please apply.

Done.

Signature · 1 line
mailto:[email protected]