From: Alan Modra <amodra@gmail.com>
To: David Edelsohn <dje.gcc@gmail.com>, Pat Haugen <pthaugen@us.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [RS6000] Fix PR54131, ICE building 416.gamess
Date: Tue, 31 Jul 2012 11:59:00 -0000 [thread overview]
Message-ID: <20120731115121.GS3182@bubble.grove.modra.org> (raw)
In-Reply-To: <OF1B2923F2.E3980D6E-ON86257A4B.00769310-86257A4B.00769C1F@us.ibm.com>
This cures the 'Y' constraint of being overly restrictive with lo_sum
offsets. I've added a comment that explains why it is wrong to limit
the range of lo_sum offsets. Bootstrapped and regressiotn tested
powerpc-linux. OK to apply?
PR target/54131
* config/rs6000/rs6000.c (mem_operand_gpr): Don't limit range
of lo_sum offsets. Comment. Assert mode at least word size
rather than bypassing powerpc64 word offset check.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 189996)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -5008,24 +5008,38 @@
Offsetting a lo_sum should not be allowed, except where we know by
alignment that a 32k boundary is not crossed, but see the ???
- comment in rs6000_legitimize_reload_address. */
+ comment in rs6000_legitimize_reload_address. Note that by
+ "offsetting" here we mean a further offset to access parts of the
+ MEM. It's fine to have a lo_sum where the inner address is offset
+ from a sym, since the same sym+offset will appear in the high part
+ of the address calculation. */
bool
mem_operand_gpr (rtx op, enum machine_mode mode)
{
unsigned HOST_WIDE_INT offset;
int extra;
+ rtx addr = XEXP (op, 0);
- op = address_offset (XEXP (op, 0));
+ op = address_offset (addr);
if (op == NULL_RTX)
return true;
offset = INTVAL (op);
+ if (TARGET_POWERPC64 && (offset & 3) != 0)
+ return false;
+
+ if (GET_CODE (addr) == LO_SUM)
+ /* We know by alignment that ABI_AIX medium/large model toc refs
+ will not cross a 32k boundary, since all entries in the
+ constant pool are naturally aligned and we check alignment for
+ other medium model toc-relative addresses. For ABI_V4 and
+ ABI_DARWIN lo_sum addresses, we just check that 64-bit
+ offsets are 4-byte aligned. */
+ return true;
+
extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD;
- if (extra < 0)
- extra = 0;
- else if (TARGET_POWERPC64 && (offset & 3) != 0)
- return false;
+ gcc_assert (extra >= 0);
return offset + 0x8000 < 0x10000u - extra;
}
\f
--
Alan Modra
Australia Development Lab, IBM
next parent reply other threads:[~2012-07-31 11:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <OF1B2923F2.E3980D6E-ON86257A4B.00769310-86257A4B.00769C1F@us.ibm.com>
2012-07-31 11:59 ` Alan Modra [this message]
2012-07-31 14:36 ` David Edelsohn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120731115121.GS3182@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=pthaugen@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).