aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Cederman <cederman@gaisler.com>2017-11-29 15:45:41 +0000
committerDaniel Hellstrom <danielh@gcc.gnu.org>2017-11-29 16:45:41 +0100
commit9d52da2f217d5b9a4fef5090251025f6a99bb108 (patch)
tree0c8bea143aebc27850e32f59e7ab965457e32546
parent6f9bc5a70fb1066611e42efea9547fa36f398065 (diff)
downloadgcc-9d52da2f217d5b9a4fef5090251025f6a99bb108.zip
gcc-9d52da2f217d5b9a4fef5090251025f6a99bb108.tar.gz
gcc-9d52da2f217d5b9a4fef5090251025f6a99bb108.tar.bz2
[SPARC] Recognize the load when accessing the GOT
Needed for the UT699 errata workaround to function correctly when compiling with -fPIC. 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: r255239
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/sparc/sparc.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a00174a..1909945 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * 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-29 Martin Aberg <maberg@gaisler.com>
* config/sparc/sparc.md (divdf3_fix): Add NOP and adjust length
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 64c88de..dac6483 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1321,7 +1321,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)
{
@@ -1359,6 +1360,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;
}
}