From 84bc583e2e9f16cff59e282985da23da3cc0730a Mon Sep 17 00:00:00 2001 From: Daniel Cederman Date: Wed, 29 Nov 2017 17:14:36 +0000 Subject: [PATCH] [SPARC] Recognize the load when accessing the GOT Needed for the UT699 errata workaround to function correctly when compiling with -fPIC. Backport from mainline 2017-11-29 Daniel Cederman 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 | 7 +++++++ gcc/config/sparc/sparc.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 42162dc2715b..ed5ca67253d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-11-29 Daniel Cederman + + 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 Backport from mainline diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 05192c92cc6c..f4c9b4084e61 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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; } } -- 2.47.2