]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[SPARC] Recognize the load when accessing the GOT
authorDaniel Cederman <cederman@gaisler.com>
Wed, 29 Nov 2017 17:14:36 +0000 (17:14 +0000)
committerDaniel Hellstrom <danielh@gcc.gnu.org>
Wed, 29 Nov 2017 17:14:36 +0000 (18:14 +0100)
Needed for the UT699 errata workaround to function correctly when
compiling with -fPIC.

Backport from mainline
2017-11-29  Daniel Cederman  <cederman@gaisler.com>

gcc/
* config/sparc/sparc.c (sparc_do_work_around_errata): Treat the
        movsi_pic_gotdata_op instruction as a load for the UT699 errata
        workaround.

From-SVN: r255246

gcc/ChangeLog
gcc/config/sparc/sparc.c

index 42162dc2715b90bc5a34098251cb3d6931d1f398..ed5ca67253d0c571d1801ea3a3adcd7c586fba19 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-29  Daniel Cederman  <cederman@gaisler.com>
+
+       Backport from mainline
+       * config/sparc/sparc.c (sparc_do_work_around_errata): Treat the
+        movsi_pic_gotdata_op instruction as a load for the UT699 errata
+        workaround.
+
 2017-11-24  Segher Boessenkool  <segher@kernel.crashing.org>
 
        Backport from mainline
index 05192c92cc6c6c91a1c5d1308eb67093c7aba5a5..f4c9b4084e6146517a88033d2bd7a55be1935f89 100644 (file)
@@ -969,7 +969,8 @@ sparc_do_work_around_errata (void)
               && NONJUMP_INSN_P (insn)
               && (set = single_set (insn)) != NULL_RTX
               && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) <= 4
-              && mem_ref (SET_SRC (set)) != NULL_RTX
+              && (mem_ref (SET_SRC (set)) != NULL_RTX
+                  || INSN_CODE (insn) == CODE_FOR_movsi_pic_gotdata_op)
               && REG_P (SET_DEST (set))
               && REGNO (SET_DEST (set)) < 32)
        {
@@ -1007,6 +1008,11 @@ sparc_do_work_around_errata (void)
                               && REGNO (src) != REGNO (x)))
                       && !reg_mentioned_p (x, XEXP (dest, 0)))
                insert_nop = true;
+
+             /* GOT accesses uses LD.  */
+             else if (INSN_CODE (next) == CODE_FOR_movsi_pic_gotdata_op
+                      && !reg_mentioned_p (x, XEXP (XEXP (src, 0), 1)))
+               insert_nop = true;
            }
        }