diff mbox

[rs6000] Fix little-endian access to sdmode_stack_slot

Message ID 201311172112.rAHLCxOp003742@d06av02.portsmouth.uk.ibm.com
State New
Headers show

Commit Message

Ulrich Weigand Nov. 17, 2013, 9:12 p.m. UTC
Hello,

when accessing the sdmode_stack_slot, code in rs6000_emit_move would
unconditionally use
	rtx mem = adjust_address_nv (operands[0], mode, 4);

This is wrong in little-endian mode; we always need to access the
low word there too.

Fixed by the patch below, which fixes a large number of DFP test
suite failures in little-endian.

Tested on powerpc64-linux and powerpc64le-linux.

OK for mainline?

Bye,
Ulrich



ChangeLog:

	* config/rs6000/rs6000.c (rs6000_emit_move): Use low word of
	sdmode_stack_slot also in little-endian mode.

Comments

David Edelsohn Nov. 17, 2013, 11:26 p.m. UTC | #1
On Sun, Nov 17, 2013 at 4:12 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Hello,
>
> when accessing the sdmode_stack_slot, code in rs6000_emit_move would
> unconditionally use
>         rtx mem = adjust_address_nv (operands[0], mode, 4);
>
> This is wrong in little-endian mode; we always need to access the
> low word there too.
>
> Fixed by the patch below, which fixes a large number of DFP test
> suite failures in little-endian.
>
> Tested on powerpc64-linux and powerpc64le-linux.
>
> OK for mainline?

> ChangeLog:
>
>         * config/rs6000/rs6000.c (rs6000_emit_move): Use low word of
>         sdmode_stack_slot also in little-endian mode.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 204919)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -8188,7 +8188,9 @@ 
 	}
       else if (INT_REGNO_P (REGNO (operands[1])))
 	{
-	  rtx mem = adjust_address_nv (operands[0], mode, 4);
+	  rtx mem = operands[0];
+	  if (BYTES_BIG_ENDIAN)
+	    mem = adjust_address_nv (mem, mode, 4);
 	  mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
 	  emit_insn (gen_movsd_hardfloat (mem, operands[1]));
 	}
@@ -8211,7 +8213,9 @@ 
 	}
       else if (INT_REGNO_P (REGNO (operands[0])))
 	{
-	  rtx mem = adjust_address_nv (operands[1], mode, 4);
+	  rtx mem = operands[1];
+	  if (BYTES_BIG_ENDIAN)
+	    mem = adjust_address_nv (mem, mode, 4);
 	  mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
 	  emit_insn (gen_movsd_hardfloat (operands[0], mem));
 	}