This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch applied to sh port: fix gcc.dg/compat/scalar-return-4 c_compat_x_tst.o compile
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Jun 2003 16:01:02 +0100
- Subject: patch applied to sh port: fix gcc.dg/compat/scalar-return-4 c_compat_x_tst.o compile
- Organization: SuperH UK Ltd.
This turned out to be an expander and predicates problem rather than
a constraint problem.
But there are enough other reasons to clean up the SH constraints, so
I'm working on getting that finished too.
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
2003-06-16 J"orn Rennecke <joern.rennecke@superh.com>
* sh.c (prepare_move_operand): Check if operand 0 is an invalid
memory reference. Fix test that checks if operand 1 is using r0.
* sh.md (movhi_i): Don't allow st.w r0,@(rX,rY) .
Index: sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.216
diff -p -r1.216 sh.c
*** sh.c 10 Jun 2003 20:53:31 -0000 1.216
--- sh.c 16 Jun 2003 13:53:14 -0000
*************** prepare_move_operands (operands, mode)
*** 762,772 ****
&& ! sh_register_operand (operands[1], mode))
operands[1] = copy_to_mode_reg (mode, operands[1]);
/* This case can happen while generating code to move the result
of a library call to the target. Reject `st r0,@(rX,rY)' because
reload will fail to find a spill register for rX, since r0 is already
being used for the source. */
! else if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 0
&& GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) == PLUS
&& GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == REG)
--- 770,789 ----
&& ! sh_register_operand (operands[1], mode))
operands[1] = copy_to_mode_reg (mode, operands[1]);
+ if (GET_CODE (operands[0]) == MEM && ! memory_operand (operands[0], mode))
+ {
+ /* This is like change_address_1 (operands[0], mode, 0, 1) ,
+ except that we can't use that function because it is static. */
+ rtx new = change_address (operands[0], mode, 0);
+ MEM_COPY_ATTRIBUTES (new, operands[0]);
+ operands[0] = new;
+ }
+
/* This case can happen while generating code to move the result
of a library call to the target. Reject `st r0,@(rX,rY)' because
reload will fail to find a spill register for rX, since r0 is already
being used for the source. */
! else if (refers_to_regno_p (R0_REG, R0_REG + 1, operands[1], (rtx *)0)
&& GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) == PLUS
&& GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == REG)
Index: sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.147
diff -p -r1.147 sh.md
*** sh.md 12 Jun 2003 12:03:25 -0000 1.147
--- sh.md 16 Jun 2003 13:53:14 -0000
***************
*** 3674,3685 ****
operands[3] = gen_rtx_REG (DImode, REGNO (operands[2]));
}")
(define_insn "movhi_i"
[(set (match_operand:HI 0 "general_movdst_operand" "=r,r,r,r,m,r,l,r")
(match_operand:HI 1 "general_movsrc_operand" "Q,rI,m,t,r,l,r,i"))]
"TARGET_SH1
&& (arith_reg_operand (operands[0], HImode)
! || arith_reg_operand (operands[1], HImode))"
"@
mov.w %1,%0
mov %1,%0
--- 3682,3698 ----
operands[3] = gen_rtx_REG (DImode, REGNO (operands[2]));
}")
+ /* When storing r0, we have to avoid reg+reg addressing. */
(define_insn "movhi_i"
[(set (match_operand:HI 0 "general_movdst_operand" "=r,r,r,r,m,r,l,r")
(match_operand:HI 1 "general_movsrc_operand" "Q,rI,m,t,r,l,r,i"))]
"TARGET_SH1
&& (arith_reg_operand (operands[0], HImode)
! || arith_reg_operand (operands[1], HImode))
! && (GET_CODE (operands[0]) != MEM
! || GET_CODE (XEXP (operands[0], 0)) != PLUS
! || GET_CODE (XEXP (XEXP (operands[0], 0), 1)) != REG
! || ! refers_to_regno_p (R0_REG, R0_REG + 1, operands[1], (rtx *)0))"
"@
mov.w %1,%0
mov %1,%0