allow SFmode in CTR/LR/MQ on rs6000

Geoffrey Keating gkeating@apple.com
Thu Oct 17 17:25:00 GMT 2002


This should fix the -Os simd-4 failure on Darwin, and hopefully the
similar failures on other ppc targets.

Bootstrapped & tested on powerpc-darwin6.0; I also ran the testsuite
with -msoft-float, and the results looked reasonable by eye.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/rs6000-ctrmoves.patch=====================
2002-10-17  Geoffrey Keating  <geoffk@apple.com>

	* config/rs6000/rs6000.h (HARD_REGNO_MODE_OK): Allow arbitrary modes
	in CTR/LR/MQ.
	* config/rs6000/rs6000.md (movcc_internal1): Support CCmode moves
	to/from CTR/LR/MQ.
	(movsf_hardfloat): Support SFmode moves to/from CTR/LR/MQ.
	(movsf_softfloat): Likewise.

Index: config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.216
diff -u -p -u -p -r1.216 rs6000.md
--- config/rs6000/rs6000.md	9 Oct 2002 20:54:05 -0000	1.216
+++ config/rs6000/rs6000.md	18 Oct 2002 00:13:47 -0000
@@ -8349,8 +8349,8 @@
   "")
 
 (define_insn "*movcc_internal1"
-  [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
-	(match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
+  [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,cl,q,r,r,m")
+	(match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,r,r,h,m,r"))]
   "register_operand (operands[0], CCmode)
    || register_operand (operands[1], CCmode)"
   "@
@@ -8360,10 +8360,13 @@
    mfcr %0
    mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
    mr %0,%1
+   mt%0 %1
+   mt%0 %1
+   mf%1 %0
    {l%U1%X1|lwz%U1%X1} %0,%1
    {st%U0%U1|stw%U0%U1} %1,%0"
-  [(set_attr "type" "cr_logical,cr_logical,cr_logical,cr_logical,cr_logical,*,load,store")
-   (set_attr "length" "*,*,12,*,8,*,*,*")])
+  [(set_attr "type" "cr_logical,cr_logical,cr_logical,cr_logical,cr_logical,*,*,mtjmpr,*,load,store")
+   (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
 
 ;; For floating-point, we normally deal with the floating-point registers
 ;; unless -msoft-float is used.  The sole exception is that parameter passing
@@ -8402,8 +8405,8 @@
 }")
 
 (define_insn "*movsf_hardfloat"
-  [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!r,!r")
-	(match_operand:SF 1 "input_operand" "r,m,r,f,m,f,G,Fn"))]
+  [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r")
+	(match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))]
   "(gpc_reg_operand (operands[0], SFmode)
    || gpc_reg_operand (operands[1], SFmode))
    && (TARGET_HARD_FLOAT && TARGET_FPRS)"
@@ -8414,19 +8417,25 @@
    fmr %0,%1
    lfs%U1%X1 %0,%1
    stfs%U0%X0 %1,%0
+   mt%0 %1
+   mt%0 %1
+   mf%1 %0
    #
    #"
-  [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*")
-   (set_attr "length" "4,4,4,4,4,4,4,8")])
+  [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
+   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
 
 (define_insn "*movsf_softfloat"
-  [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
-	(match_operand:SF 1 "input_operand" "r,m,r,I,L,R,G,Fn"))]
+  [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r")
+	(match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn"))]
   "(gpc_reg_operand (operands[0], SFmode)
    || gpc_reg_operand (operands[1], SFmode))
    && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
   "@
    mr %0,%1
+   mt%0 %1
+   mt%0 %1
+   mf%1 %0
    {l%U1%X1|lwz%U1%X1} %0,%1
    {st%U0%X0|stw%U0%X0} %1,%0
    {lil|li} %0,%1
@@ -8434,8 +8443,8 @@
    {cal|la} %0,%a1
    #
    #"
-  [(set_attr "type" "*,load,store,*,*,*,*,*")
-   (set_attr "length" "4,4,4,4,4,4,4,8")])
+  [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*")
+   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
 
 
 (define_expand "movdf"
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.231
diff -u -p -u -p -r1.231 rs6000.h
--- config/rs6000/rs6000.h	7 Oct 2002 19:12:04 -0000	1.231
+++ config/rs6000/rs6000.h	18 Oct 2002 00:13:47 -0000
@@ -903,8 +903,7 @@ extern int rs6000_default_long_calls;
    : SPE_SIMD_REGNO_P (REGNO) && TARGET_SPE && SPE_VECTOR_MODE (MODE) ? 1 \
    : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC		\
    : XER_REGNO_P (REGNO) ? (MODE) == PSImode				\
-   : ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT		\
-			      && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
+   : ! INT_REGNO_P (REGNO) ? GET_MODE_SIZE (MODE) <= UNITS_PER_WORD	\
    : 1)
 
 /* Value is 1 if it is a good idea to tie two pseudo registers
============================================================



More information about the Gcc-patches mailing list