]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR target/58067
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2013 09:09:58 +0000 (09:09 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2013 09:09:58 +0000 (09:09 +0000)
* config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC
and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle
there also UNSPEC_PLTOFF.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201720 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c

index 8dc071d796109076a137794bbc28c32836485a2f..0715f74e684888ce4d52da0ca98fd5f4d6ed14d9 100644 (file)
@@ -1,3 +1,11 @@
+2013-08-14  Jakub Jelinek  <jakub@redhat.com>
+           Alexandre Oliva  <aoliva@redhat.com>
+
+       PR target/58067
+       * config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC
+       and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle
+       there also UNSPEC_PLTOFF.
+
 2013-08-14  Marek Polacek  <polacek@redhat.com>
 
        * ipa-inline-analysis.c (add_clause): Avoid shifting integer
index e3f345ab925d7b7a39a20e9ccb500c6b52f697c0..dd1a6a8196f1d28c977b4df069045c61efd7ad1e 100644 (file)
@@ -14124,21 +14124,29 @@ ix86_delegitimize_address (rtx x)
            x = replace_equiv_address_nv (orig_x, x);
          return x;
        }
-      if (GET_CODE (x) != CONST
-         || GET_CODE (XEXP (x, 0)) != UNSPEC
-         || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL
-             && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)
-         || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL))
-       return ix86_delegitimize_tls_address (orig_x);
-      x = XVECEXP (XEXP (x, 0), 0, 0);
-      if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x))
+
+      if (GET_CODE (x) == CONST
+         && GET_CODE (XEXP (x, 0)) == UNSPEC
+         && (XINT (XEXP (x, 0), 1) == UNSPEC_GOTPCREL
+             || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL)
+         && (MEM_P (orig_x) || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL))
        {
-         x = simplify_gen_subreg (GET_MODE (orig_x), x,
-                                  GET_MODE (x), 0);
-         if (x == NULL_RTX)
-           return orig_x;
+         x = XVECEXP (XEXP (x, 0), 0, 0);
+         if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x))
+           {
+             x = simplify_gen_subreg (GET_MODE (orig_x), x,
+                                      GET_MODE (x), 0);
+             if (x == NULL_RTX)
+               return orig_x;
+           }
+         return x;
        }
-      return x;
+
+      if (ix86_cmodel != CM_MEDIUM_PIC && ix86_cmodel != CM_LARGE_PIC)
+       return ix86_delegitimize_tls_address (orig_x);
+
+      /* Fall thru into the code shared with -m32 for -mcmodel=large -fpic
+        and -mcmodel=medium -fpic.  */
     }
 
   if (GET_CODE (x) != PLUS
@@ -14175,10 +14183,12 @@ ix86_delegitimize_address (rtx x)
 
   if (GET_CODE (x) == UNSPEC
       && ((XINT (x, 1) == UNSPEC_GOT && MEM_P (orig_x) && !addend)
-         || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x))))
+         || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x))
+         || (XINT (x, 1) == UNSPEC_PLTOFF && ix86_cmodel == CM_LARGE_PIC
+             && !MEM_P (orig_x) && !addend)))
     result = XVECEXP (x, 0, 0);
 
-  if (TARGET_MACHO && darwin_local_data_pic (x)
+  if (!TARGET_64BIT && TARGET_MACHO && darwin_local_data_pic (x)
       && !MEM_P (orig_x))
     result = XVECEXP (x, 0, 0);