This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/2] [SPARC] Recognize the load when accessing the GOT
- From: Daniel Cederman <cederman at gaisler dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ebotcazou at adacore dot com, sebastian dot huber at embedded-brains dot de, daniel at gaisler dot com
- Date: Mon, 27 Nov 2017 11:04:35 +0100
- Subject: [PATCH 2/2] [SPARC] Recognize the load when accessing the GOT
- Authentication-results: sourceware.org; auth=none
- Authorized-sender: cederman at gaisler dot com
- References: <20171127100435.6055-1-cederman@gaisler.com>
Needed for the UT699 errata workaround to function correctly when
compiling with -fPIC.
gcc/ChangeLog:
2017-11-27 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.
---
gcc/config/sparc/sparc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 6e91114..8b11c1a 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;
}
}
--
2.9.3