The second branch of the alternative in emit_spill_move correctly uses 
gen_lowpart_SUBREG to build a lowpart SUBREG, whereas the first branch uses 
gen_rtx_SUBREG (..., ..., 0), which of course badly breaks on big-endian.

Tested on x86_64/Linux and SPARC/Solaris, applied on the mainline as obvious.


2016-12-03  Eric Botcazou  <ebotca...@adacore.com>

        * lra-constraints.c (emit_spill_move): Use gen_lowpart_SUBREG in all
        cases to build a lowpart SUBREG.

-- 
Eric Botcazou
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 243172)
+++ lra-constraints.c	(working copy)
@@ -1109,9 +1109,9 @@ emit_spill_move (bool to_p, rtx mem_pseu
 	 dependent macro HARD_REGNO_CALLER_SAVE_MODE.  */
       if (! MEM_P (val))
 	{
-	  val = gen_rtx_SUBREG (GET_MODE (mem_pseudo),
-				GET_CODE (val) == SUBREG ? SUBREG_REG (val) : val,
-				0);
+	  val = gen_lowpart_SUBREG (GET_MODE (mem_pseudo),
+				    GET_CODE (val) == SUBREG
+				    ? SUBREG_REG (val) : val);
 	  LRA_SUBREG_P (val) = 1;
 	}
       else

Reply via email to