Patchwork [RFA,pr,target/60648] Fix non-canonical RTL from x86 backend -- P1 regression

login
register
mail settings
Submitter Jakub Jelinek
Date March 29, 2014, 11:12 a.m.
Message ID <20140329111245.GS1817@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/334948/
State New
Headers show

Comments

Jakub Jelinek - March 29, 2014, 11:12 a.m.
On Fri, Mar 28, 2014 at 07:12:26PM +0100, Jakub Jelinek wrote:
> On Fri, Mar 28, 2014 at 12:04:00PM -0600, Jeff Law wrote:
> > Here's the updated patch.  It uses simplify_gen_binary in expr.c to
> > simplify the address expression as we're building it.  It also uses
> > copy_addr_to_reg in the x86 backend to avoid the possibility of
> > generating non-canonical RTL there too.
> > 
> > By accident I interrupted the regression test cycle, so that is
> > still running.  OK for the trunk if that passes?
> 
> Ok, thanks.

Sorry for not catching this earlier, but the testcase was misplaced,
the two dg-do compile directives where only one was limited to i?86/x86_64
meant the test was run on all targets and explicit -fPIC could break on
non-pic targets and explicit -m32 broke on all targets that don't support
-m32.

Fixed thusly, verified the test still fails
(RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg-torture.exp=pr60648.C')
without your fix and works with it and committed as obvious.

2014-03-29  Jakub Jelinek  <jakub@redhat.com>

	PR target/60648
	* g++.dg/pr60648.C: Move test to...
	* g++.dg/torture/pr60648.C: ... here.  Run on all targets, remove
	dg-options, add for fpic targets dg-additional-options -fPIC.


	Jakub

Patch

--- gcc/testsuite/g++.dg/pr60648.C.jj	2014-03-28 23:06:43.000000000 +0100
+++ gcc/testsuite/g++.dg/pr60648.C	2014-03-29 12:02:03.014367559 +0100
@@ -1,73 +0,0 @@ 
-/* { dg-do compile } */
-/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O3 -fPIC -m32" }  */
-
-enum component
-{
-  Ex,
-  Ez,
-  Hy,
-  Permeability
-};
-enum derived_component
-{};
-enum direction
-{
-  X,
-  Y,
-  Z,
-  R,
-  P,
-  NO_DIRECTION
-};
-derived_component a;
-component *b;
-component c;
-direction d;
-inline direction fn1 (component p1)
-{
-  switch (p1)
-    {
-    case 0:
-      return Y;
-    case 1:
-      return Z;
-    case Permeability:
-      return NO_DIRECTION;
-    }
-  return X;
-}
-
-inline component fn2 (direction p1)
-{
-  switch (p1)
-    {
-    case 0:
-    case 1:
-      return component ();
-    case Z:
-    case R:
-      return component (1);
-    case P:
-      return component (3);
-    }
-}
-
-void fn3 ()
-{
-  direction e;
-  switch (0)
-  case 0:
-  switch (a)
-    {
-    case 0:
-      c = Ex;
-      b[1] = Hy;
-    }
-  e = fn1 (b[1]);
-  b[1] = fn2 (e);
-  d = fn1 (c);
-}
-
-
-
--- gcc/testsuite/g++.dg/torture/pr60648.C.jj	2014-03-29 12:01:57.999392178 +0100
+++ gcc/testsuite/g++.dg/torture/pr60648.C	2014-03-29 12:05:44.452182659 +0100
@@ -0,0 +1,70 @@ 
+// PR target/60648
+// { dg-do compile }
+// { dg-additional-options "-fPIC" { target fpic } }
+
+enum component
+{
+  Ex,
+  Ez,
+  Hy,
+  Permeability
+};
+enum derived_component
+{};
+enum direction
+{
+  X,
+  Y,
+  Z,
+  R,
+  P,
+  NO_DIRECTION
+};
+derived_component a;
+component *b;
+component c;
+direction d;
+inline direction fn1 (component p1)
+{
+  switch (p1)
+    {
+    case 0:
+      return Y;
+    case 1:
+      return Z;
+    case Permeability:
+      return NO_DIRECTION;
+    }
+  return X;
+}
+
+inline component fn2 (direction p1)
+{
+  switch (p1)
+    {
+    case 0:
+    case 1:
+      return component ();
+    case Z:
+    case R:
+      return component (1);
+    case P:
+      return component (3);
+    }
+}
+
+void fn3 ()
+{
+  direction e;
+  switch (0)
+  case 0:
+  switch (a)
+    {
+    case 0:
+      c = Ex;
+      b[1] = Hy;
+    }
+  e = fn1 (b[1]);
+  b[1] = fn2 (e);
+  d = fn1 (c);
+}