aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-03-05 09:29:07 +1030
committerAlan Modra <amodra@gcc.gnu.org>2011-03-05 09:29:07 +1030
commitea868305675efc1aab86644c80b8f23228b813f8 (patch)
treee739008a93f3c1b46205efebc50f58cba25448d0
parented4f96af593f3ac7fa5926fa31052bb97118534d (diff)
downloadgcc-ea868305675efc1aab86644c80b8f23228b813f8.zip
gcc-ea868305675efc1aab86644c80b8f23228b813f8.tar.gz
gcc-ea868305675efc1aab86644c80b8f23228b813f8.tar.bz2
re PR target/47986 (gcc.c-torture/execute/20040709-1.c fails with non-delegitimized UNSPEC)
PR target/47986 * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle full cmodel medium/large lo_sum + high addresses. From-SVN: r170687
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/rs6000.c20
2 files changed, 19 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 76a2bd2..9cb86c6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-05 Alan Modra <amodra@gmail.com>
+
+ PR target/47986
+ * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
+ full cmodel medium/large lo_sum + high addresses.
+
2011-03-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c (s390_decompose_address): Reject non-literal
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index df02bef..fd80f8b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6248,17 +6248,23 @@ rs6000_delegitimize_address (rtx orig_x)
if (MEM_P (x))
x = XEXP (x, 0);
- if ((GET_CODE (x) == PLUS
- || GET_CODE (x) == LO_SUM)
- && GET_CODE (XEXP (x, 0)) == REG
- && (REGNO (XEXP (x, 0)) == TOC_REGISTER
- || TARGET_MINIMAL_TOC
- || TARGET_CMODEL != CMODEL_SMALL)
+ if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS)
&& GET_CODE (XEXP (x, 1)) == CONST)
{
y = XEXP (XEXP (x, 1), 0);
if (GET_CODE (y) == UNSPEC
- && XINT (y, 1) == UNSPEC_TOCREL)
+ && XINT (y, 1) == UNSPEC_TOCREL
+ && ((GET_CODE (XEXP (x, 0)) == REG
+ && (REGNO (XEXP (x, 0)) == TOC_REGISTER
+ || TARGET_MINIMAL_TOC
+ || TARGET_CMODEL != CMODEL_SMALL))
+ || (TARGET_CMODEL != CMODEL_SMALL
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
+ && REGNO (XEXP (XEXP (x, 0), 0)) == TOC_REGISTER
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH
+ && rtx_equal_p (XEXP (x, 1),
+ XEXP (XEXP (XEXP (x, 0), 1), 0)))))
{
y = XVECEXP (y, 0, 0);
if (!MEM_P (orig_x))