OSDN Git Service

Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 May 2014 15:59:37 +0000 (15:59 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 May 2014 15:59:37 +0000 (15:59 +0000)
2013-07-03  Jakub Jelinek  <jakub@redhat.com>

PR target/57777
* config/i386/predicates.md (vsib_address_operand): Disallow
SYMBOL_REF or LABEL_REF in parts.disp if TARGET_64BIT && flag_pic.

* gcc.target/i386/pr57777.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@210169 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr57777.c [new file with mode: 0644]

index ea476d5..f2b7b9e 100644 (file)
@@ -1,6 +1,12 @@
 2014-05-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/57777
+       * config/i386/predicates.md (vsib_address_operand): Disallow
+       SYMBOL_REF or LABEL_REF in parts.disp if TARGET_64BIT && flag_pic.
+
        2013-06-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/57623
index 9e31291..ba83572 100644 (file)
     return false;
 
   /* VSIB addressing doesn't support (%rip).  */
-  if (parts.disp && GET_CODE (parts.disp) == CONST)
+  if (parts.disp)
     {
-      disp = XEXP (parts.disp, 0);
-      if (GET_CODE (disp) == PLUS)
-       disp = XEXP (disp, 0);
-      if (GET_CODE (disp) == UNSPEC)
-       switch (XINT (disp, 1))
-         {
-         case UNSPEC_GOTPCREL:
-         case UNSPEC_PCREL:
-         case UNSPEC_GOTNTPOFF:
-           return false;
-         }
+      disp = parts.disp;
+      if (GET_CODE (disp) == CONST)
+       {
+         disp = XEXP (disp, 0);
+         if (GET_CODE (disp) == PLUS)
+           disp = XEXP (disp, 0);
+         if (GET_CODE (disp) == UNSPEC)
+           switch (XINT (disp, 1))
+             {
+             case UNSPEC_GOTPCREL:
+             case UNSPEC_PCREL:
+             case UNSPEC_GOTNTPOFF:
+               return false;
+             }
+       }
+      if (TARGET_64BIT
+         && flag_pic
+         && (GET_CODE (disp) == SYMBOL_REF
+             || GET_CODE (disp) == LABEL_REF))
+       return false;
     }
 
   return true;
index 3723fc0..385241c 100644 (file)
@@ -1,6 +1,11 @@
 2014-05-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/57777
+       * gcc.target/i386/pr57777.c: New test.
+
        2013-06-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/57623
diff --git a/gcc/testsuite/gcc.target/i386/pr57777.c b/gcc/testsuite/gcc.target/i386/pr57777.c
new file mode 100644 (file)
index 0000000..9c1a392
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/57777 */
+/* { dg-do assemble { target avx2 } } */
+/* { dg-options "-O3 -mavx2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+
+void
+foo (unsigned long *x, int *y)
+{
+  static unsigned long b[2] = { 0x0UL, 0x9908b0dfUL };
+  int c;
+  for (c = 0; c < 512; c++)
+    x[c] = b[x[c] & 1UL];
+}