Skip to contentSkip to conversation

Only one call output register needed for 64 bit hosts

PATCH Applied Stefan Weil 5 participants 11 messages Sep 5, 2011 – Sep 17, 2011

lore
Share & tools
lore
#0 lore raw

cover Only one call output register needed for 64 bit hosts

The number of registers needed for the return value of TCG opcode INDEX_op_call is calculated in function tcg_gen_callN (nb_rets).

It can be 0 or 1, for 32 bit hosts also 2 (return 64 bit value in two 32 bit registers).

Some TCG implementations reserve 2 registers although only 1 is used. The following patches fix this.

[PATCH 1/5] tcg/i386: Only one call output register needed for 64 bit hosts [PATCH 2/5] tcg/ia64: Only one call output register needed for 64 bit hosts [PATCH 3/5] tcg/s390: Only one call output register needed for 64 bit hosts [PATCH 4/5] tcg/sparc: Only one call output register needed for 64 bit hosts [PATCH 5/5] tcg/ppc64: Only one call output register needed for 64 bit hosts

#1 lore raw

PATCH 1/5 tcg/i386: Only one call output register needed for 64 bit hosts

The second register is only needed for 32 bit hosts.

---
 tcg/i386/tcg-target.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
tcg/i386/tcg-target.c +3 -1
index 7529677..281f87d 100644
@@ -76,9 +76,11 @@ static const int tcg_target_call_iarg_regs[] = {
 #endif
 };
 
-static const int tcg_target_call_oarg_regs[2] = {
+static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_EAX,
+#if TCG_TARGET_REG_BITS == 32
     TCG_REG_EDX
+#endif
 };
 
 static uint8_t *tb_ret_addr;
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/5 tcg/ia64: Only one call output register needed for 64 bit hosts

In reply to Stefan Weil

The second register is never used for ia64 hosts.

Cc Aurelien Jarno <[email protected]>
---
 tcg/ia64/tcg-target.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
tcg/ia64/tcg-target.c +2 -3
index 9db205d..3803ab6 100644
@@ -172,9 +172,8 @@ static const int tcg_target_call_iarg_regs[8] = {
     TCG_REG_R63,
 };
 
-static const int tcg_target_call_oarg_regs[2] = {
-    TCG_REG_R8,
-    TCG_REG_R9
+static const int tcg_target_call_oarg_regs[] = {
+    TCG_REG_R8
 };
 
 /* maximum number of register used for input function arguments */
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/5 tcg/s390: Only one call output register needed for 64 bit hosts

In reply to Stefan Weil

The second register is only needed for 32 bit hosts.

Cc Alexander Graf <[email protected]>
---
 tcg/s390/tcg-target.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
tcg/s390/tcg-target.c +3 -1
index 2fc5646..b58df71 100644
@@ -252,7 +252,9 @@ static const int tcg_target_call_iarg_regs[] = {
 
 static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_R2,
-    TCG_REG_R3,
+#if TCG_TARGET_REG_BITS == 32
+    TCG_REG_R3
+#endif
 };
 
 #define S390_CC_EQ      8
Signature · 1 line
1.7.0.4
#4 lore raw

Re: [Qemu-devel] [PATCH 3/5] tcg/s390: Only one call output register needed for 64 bit hosts

Quoted 1 line · Stefan Weil

The second register is only needed for 32 bit hosts.

Looks sane to me. Richard, mind to ack?

Alex

Quoted 25 lines
Cc Alexander Graf <[email protected]>

---
tcg/s390/tcg-target.c | 4 +++-

1 files changed, 3 insertions(+), 1 deletions(-)
tcg/s390/tcg-target.c +3 -1
index 2fc5646..b58df71 100644
@@ -252,7 +252,9 @@ static const int tcg_target_call_iarg_regs[] = {
 
 static const int tcg_target_call_oarg_regs[] = {
    TCG_REG_R2,
-    TCG_REG_R3,
+#if TCG_TARGET_REG_BITS == 32
+    TCG_REG_R3
+#endif
 };
 
 #define S390_CC_EQ      8
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 4/5 tcg/sparc: Only one call output register needed for 64 bit hosts

In reply to Stefan Weil

The second register is only needed for 32 bit hosts.

---
 tcg/sparc/tcg-target.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tcg/sparc/tcg-target.c +4 -2
index ac76e11..fc3fd7f 100644
@@ -84,9 +84,11 @@ static const int tcg_target_call_iarg_regs[6] = {
     TCG_REG_O5,
 };
 
-static const int tcg_target_call_oarg_regs[2] = {
+static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_O0,
-    TCG_REG_O1,
+#if TCG_TARGET_REG_BITS == 32
+    TCG_REG_O1
+#endif
 };
 
 static inline int check_fit_tl(tcg_target_long val, unsigned int bits)
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 5/5 tcg/ppc64: Only one call output register needed for 64 bit hosts

In reply to Stefan Weil

The second register is only needed for 32 bit hosts.

Cc Vassili Karpov <[email protected]>
---
 tcg/ppc64/tcg-target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tcg/ppc64/tcg-target.c +1 -1
index d831684..bef7aac 100644
@@ -130,7 +130,7 @@ static const int tcg_target_call_iarg_regs[] = {
     TCG_REG_R10
 };
 
-static const int tcg_target_call_oarg_regs[2] = {
+static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_R3
 };
 
Signature · 1 line
1.7.0.4
#8 lore raw

Re: [Qemu-devel] [PATCH 5/5] tcg/ppc64: Only one call output register needed for 64 bit hosts

Quoted 13 lines · Stefan Weil

The second register is only needed for 32 bit hosts.

Cc Vassili Karpov <[email protected]>
---
 tcg/ppc64/tcg-target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tcg/ppc64/tcg-target.c +0 -0
index d831684..bef7aac 100644

tcg/ppc64/tcg-target.c static const int tcg_target_call_iarg_regs[] = { · line 136

Quoted 8 lines
tcg/ppc64/tcg-target.c +1 -1
@@ -130,7 +130,7 @@ static const int tcg_target_call_iarg_regs[] = {
     TCG_REG_R10
 };
 
-static const int tcg_target_call_oarg_regs[2] = {
+static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_R3
 };
 

Fine with me.

Signature · 1 line
mailto:[email protected]
#9 lore raw
In reply to Stefan Weil

Am 05.09.2011 11:06, schrieb Stefan Weil:

Quoted 6 lines

The number of registers needed for the return value of TCG opcode INDEX_op_call is calculated in function tcg_gen_callN (nb_rets).

It can be 0 or 1, for 32 bit hosts also 2 (return 64 bit value in two 32 bit registers).

Quoted 8 lines

Some TCG implementations reserve 2 registers although only 1 is used. The following patches fix this.

[PATCH 1/5] tcg/i386: Only one call output register needed for 64 bit hosts [PATCH 2/5] tcg/ia64: Only one call output register needed for 64 bit hosts [PATCH 3/5] tcg/s390: Only one call output register needed for 64 bit hosts [PATCH 4/5] tcg/sparc: Only one call output register needed for 64 bit hosts [PATCH 5/5] tcg/ppc64: Only one call output register needed for 64 bit hosts

Patch 3 was acked by Richard Henderson, so was patch 5 by Malc.

What about the other three patches (i386 / ia64, sparc)? They are all similar, so I think they could also be committed without more reviews.

Thanks,
Stefan Weil

Applied
#10 lore raw

Thanks, applied all.

Quoted 32 lines · Stefan Weil

Am 05.09.2011 11:06, schrieb Stefan Weil:

Quoted 10 lines

The number of registers needed for the return value of TCG opcode INDEX_op_call is calculated in function tcg_gen_callN (nb_rets).

It can be 0 or 1, for 32 bit hosts also 2 (return 64 bit value in two 32 bit registers).

Some TCG implementations reserve 2 registers although only 1 is used. The following patches fix this.

Quoted 10 lines

[PATCH 1/5] tcg/i386: Only one call output register needed for 64 bit hosts
[PATCH 2/5] tcg/ia64: Only one call output register needed for 64 bit hosts
[PATCH 3/5] tcg/s390: Only one call output register needed for 64 bit hosts
[PATCH 4/5] tcg/sparc: Only one call output register needed for 64 bit hosts
[PATCH 5/5] tcg/ppc64: Only one call output register needed for 64 bit hosts

Patch 3 was acked by Richard Henderson, so was patch 5 by Malc.

What about the other three patches (i386 / ia64, sparc)? They are all similar,
so I think they could also be committed without more reviews.

Thanks,
Stefan Weil