render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0016-tcg-s390-fix-ld-st-with-CONFIG_TCG_PASS_AREG0.patch

5544c1
From 0b95df52ecad351c916108e9f3a9d1bc3327b495 Mon Sep 17 00:00:00 2001
5544c1
From: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Date: Sat, 8 Sep 2012 03:45:43 +0000
5544c1
Subject: [PATCH] tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
5544c1
5544c1
The load/store slow path has been broken in e141ab52d:
5544c1
- We need to move 4 registers for store functions and 3 registers for
5544c1
  load functions and not the reverse.
5544c1
- According to the s390x calling convention the arguments of a function
5544c1
  should be zero extended. This means that the register shift should be
5544c1
  done with TCG_TYPE_I64 to ensure the higher word is correctly zero
5544c1
  extended when needed.
5544c1
5544c1
I am aware that CONFIG_TCG_PASS_AREG0 is being removed and thus that
5544c1
this patch can be improved, but doing so means it can also be applied to
5544c1
the 1.1 and 1.2 stable branches.
5544c1
5544c1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Signed-off-by: Alexander Graf <agraf@suse.de>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 tcg/s390/tcg-target.c | 14 +++++++-------
5544c1
 1 file changed, 7 insertions(+), 7 deletions(-)
5544c1
5544c1
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
5544c1
index 04662c1..99b5339 100644
5544c1
--- a/tcg/s390/tcg-target.c
5544c1
+++ b/tcg/s390/tcg-target.c
5544c1
@@ -1509,11 +1509,13 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, TCGReg data_reg,
5544c1
         tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R4, mem_index);
5544c1
 #ifdef CONFIG_TCG_PASS_AREG0
5544c1
         /* XXX/FIXME: suboptimal */
5544c1
-        tcg_out_mov(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[2],
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[3],
5544c1
+                    tcg_target_call_iarg_regs[2]);
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[2],
5544c1
                     tcg_target_call_iarg_regs[1]);
5544c1
-        tcg_out_mov(s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1],
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[1],
5544c1
                     tcg_target_call_iarg_regs[0]);
5544c1
-        tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0],
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[0],
5544c1
                     TCG_AREG0);
5544c1
 #endif
5544c1
         tgen_calli(s, (tcg_target_ulong)qemu_st_helpers[s_bits]);
5544c1
@@ -1521,13 +1523,11 @@ static void tcg_prepare_qemu_ldst(TCGContext* s, TCGReg data_reg,
5544c1
         tcg_out_movi(s, TCG_TYPE_I32, arg1, mem_index);
5544c1
 #ifdef CONFIG_TCG_PASS_AREG0
5544c1
         /* XXX/FIXME: suboptimal */
5544c1
-        tcg_out_mov(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[3],
5544c1
-                    tcg_target_call_iarg_regs[2]);
5544c1
         tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[2],
5544c1
                     tcg_target_call_iarg_regs[1]);
5544c1
-        tcg_out_mov(s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1],
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[1],
5544c1
                     tcg_target_call_iarg_regs[0]);
5544c1
-        tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0],
5544c1
+        tcg_out_mov(s, TCG_TYPE_I64, tcg_target_call_iarg_regs[0],
5544c1
                     TCG_AREG0);
5544c1
 #endif
5544c1
         tgen_calli(s, (tcg_target_ulong)qemu_ld_helpers[s_bits]);
5544c1
-- 
5544c1
1.7.12.1
5544c1