This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.4 patch] fix target/20191 (ppc) with mainline backport


This patch to mainline fixes a regression in GCC 3.4.x.  Tested on
powerpc64-linux with bootstrap and regression test using -m32 and -m64.
OK for the 3.4 branch?

Shall I add the new test to mainline and the 4.0 branch?

2005-06-15  Janis Johnson  <janis187@us.ibm.com>

	PR target/20191
	Backport from mainline:

	2004-04-23  Dale Johannesen  <dalej@apple.com>

	* config/rs6000.md (movsf_hardfloat): Add POWER form of nop.
	(movdf_hardfloat64):  Ditto.
	(movdf_softfloat64):  Ditto.

	* config/rs6000.md (movsf_hardfloat): Accept CTR-to-CTR copy.
	(movdf_hardfloat64):  Ditto.

testsuite:
2005-06-15  Janis Johnson  <janis187@us.ibm.com>

	PR target/20191
	* gcc.c-torture/compile/20050615-1.c: New test.

--- config/rs6000/rs6000.md.orig	2005-06-14 11:08:15.959387560 -0700
+++ config/rs6000/rs6000.md	2005-06-14 14:38:33.400313800 -0700
@@ -7839,8 +7839,8 @@
 }")
 
 (define_insn "*movsf_hardfloat"
-  [(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"))]
+  [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
+	(match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
   "(gpc_reg_operand (operands[0], SFmode)
    || gpc_reg_operand (operands[1], SFmode))
    && (TARGET_HARD_FLOAT && TARGET_FPRS)"
@@ -7854,10 +7854,11 @@
    mt%0 %1
    mt%0 %1
    mf%1 %0
+   {cror 0,0,0|nop}
    #
    #"
-  [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
-   (set_attr "length" "4,4,4,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,4,8")])
 
 (define_insn "*movsf_softfloat"
   [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
@@ -8114,8 +8115,8 @@
 ; ld/std require word-aligned displacements -> 'Y' constraint.
 ; List Y->r and r->Y before r->r for reload.
 (define_insn "*movdf_hardfloat64"
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,b,!r,f,f,m,!cl,!r,!r,!r,!r")
-	(match_operand:DF 1 "input_operand" "r,Y,m,r,f,m,f,r,h,G,H,F"))]
+  [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,b,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
+	(match_operand:DF 1 "input_operand" "r,Y,m,r,f,m,f,r,h,0,G,H,F"))]
   "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
    && (gpc_reg_operand (operands[0], DFmode)
        || gpc_reg_operand (operands[1], DFmode))"
@@ -8129,11 +8130,12 @@
    stfd%U0%X0 %1,%0
    mt%0 %1
    mf%1 %0
+   {cror 0,0,0|nop}
    #
    #
    #"
-  [(set_attr "type" "store,load,load,*,fp,fpload,fpstore,mtjmpr,*,*,*,*")
-   (set_attr "length" "4,4,8,4,4,4,4,4,4,8,12,16")])
+  [(set_attr "type" "store,load,load,*,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
+   (set_attr "length" "4,4,8,4,4,4,4,4,4,4,8,12,16")])
 
 (define_split
   [(set (match_operand:DF 0 "base_reg_operand" "")
@@ -8191,7 +8193,7 @@
    #
    #
    #
-   nop"
+   {cror 0,0,0|nop}"
   [(set_attr "type" "load,store,*,*,*,*,*,*,*")
    (set_attr "length" "4,4,4,4,4,8,12,16,4")])
 
--- /dev/null	2004-06-24 11:06:20.000000000 -0700
+++ gcc.c-torture/compile/20050615-1.c	2005-06-15 11:35:06.000000000 -0700
@@ -0,0 +1,57 @@
+/* Test for PR target/20191.  */
+
+struct S1;
+
+struct S1 {
+  struct S1 *next;
+  float x;
+};
+
+struct S2 {
+  float y;
+};
+
+extern int func_ex1 (float);
+
+extern int f;
+extern float n;
+extern struct S1 *bp1;
+extern struct S2 *bp2;
+
+inline float
+func1 (int f, struct S2 *p2)
+{
+  float a;
+
+  if (f)
+    a = n >= p2->y ? n : p2->y;
+  else
+    a = n;
+  return a;
+}
+
+inline float
+func2 (struct S1 *p1, struct S2 *p2)
+{
+  float a, b;
+
+  if(n <= 1.0)
+    b = func1 (f, p2);
+  else
+    {
+       a = n <= p1->x ? 0.0 : p1->x;
+       b = a >= p2->y ? a : p2->y;
+    }
+  return(b);
+}
+
+void
+func3 (struct S1 *p)
+{
+  float a = 0.0;
+
+  if (f)
+    a = func2 (bp1, bp2);
+  if (func_ex1 (a))
+    bp1 = p;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]