From: Nathan Froyd <froydnj@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Cc: dje.gcc@gmail.com
Subject: [PATCH] fix ICEs for powerpc-linux-gnuspe configs
Date: Fri, 11 Sep 2009 01:18:00 -0000 [thread overview]
Message-ID: <20090911005122.GT32063@codesourcery.com> (raw)
The patch below fixes a number of ICEs that occur while running the
testsuite for powerpc-linux-gnuspe. The problematic commit seems to be:
2009-06-25 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR target/38731
* config/rs6000/rs6000.c (LOCAL_ALIGNMENT): Redefine to just use
DATA_ALIGNMENT instead.
Before this commit, LOCAL_ALIGNMENT looked like:
#define LOCAL_ALIGNMENT(TYPE, ALIGN) \
((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) ? 128 : \
(TARGET_E500_DOUBLE \
&& TYPE_MODE (TYPE) == DFmode) ? 64 : \
((TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE \
&& SPE_VECTOR_MODE (TYPE_MODE (TYPE))) || (TARGET_PAIRED_FLOAT \
&& TREE_CODE (TYPE) == VECTOR_TYPE \
&& PAIRED_VECTOR_MODE (TYPE_MODE (TYPE)))) ? 64 : ALIGN)
After this commit, LOCAL_ALIGNMENT simply forwards to DATA_ALIGNMENT,
which looks like:
#define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == VECTOR_TYPE ? ((TARGET_SPE_ABI \
|| TARGET_PAIRED_FLOAT) ? 64 : 128) \
: (TARGET_E500_DOUBLE \
&& TYPE_MODE (TYPE) == DFmode) ? 64 \
: TREE_CODE (TYPE) == ARRAY_TYPE \
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
The first set of problems is due to DATA_ALIGNMENT assuming that if we
have a VECTOR_TYPE and we are compiling for SPE, then the TYPE_MODE of
the type is automatically a valid SPE_VECTOR_MODE. It's not, for cases
like:
typedef float V8SF __attribute__ ((vector_size (32)));
(from gcc.c-torture/compile/pr33617.c). The other problem is that in
cases like gcc.dg/array-7.c, TYPE doesn't have to be a tcc_type; it can
be error_mark_node: if the type of the array was incomplete, for
instance. (Obviously LOCAL_ALIGNMENT didn't catch that case before; I'm
not quite sure why it worked. Maybe it was broken by a different
commit; since the SPE target has presumably been broken since late June,
it seems nobody does regular testing there.)
The patch fixes DATA_ALIGNMENT to check TYPE_MODE of VECTOR_TYPE a
little more strictly and to make sure that we have a tcc_type because we
go poking for the TYPE_MODE. I took the liberty of reformatting the
code a little bit too. Tested with a cross to powerpc-linux-gnuspe,
where it fixes many ICEs. OK to commit?
-Nathan
2009-09-10 Nathan Froyd <froydnj@codesourcery.com>
* config/rs6000/rs6000.h (DATA_ALIGNMENT): Check that we are dealing
with actual SPE/paired vector modes before using 64-bit alignment.
Check that TYPE is a REAL_TYPE for TARGET_E500_DOUBLE.
Index: rs6000.h
===================================================================
--- rs6000.h (revision 151592)
+++ rs6000.h (working copy)
@@ -743,14 +743,18 @@ extern unsigned rs6000_pointer_size;
/* Make arrays of chars word-aligned for the same reasons.
Align vectors to 128 bits. Align SPE vectors and E500 v2 doubles to
64 bits. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == VECTOR_TYPE ? ((TARGET_SPE_ABI \
- || TARGET_PAIRED_FLOAT) ? 64 : 128) \
- : (TARGET_E500_DOUBLE \
- && TYPE_MODE (TYPE) == DFmode) ? 64 \
- : TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
+#define DATA_ALIGNMENT(TYPE, ALIGN) \
+ (TREE_CODE (TYPE) == VECTOR_TYPE \
+ ? (((TARGET_SPE && SPE_VECTOR_MODE (TYPE_MODE (TYPE))) \
+ || (TARGET_PAIRED_FLOAT && PAIRED_VECTOR_MODE (TYPE_MODE (TYPE)))) \
+ ? 64 : 128) \
+ : ((TARGET_E500_DOUBLE \
+ && TREE_CODE (TYPE) == REAL_TYPE \
+ && TYPE_MODE (TYPE) == DFmode) \
+ ? 64 \
+ : (TREE_CODE (TYPE) == ARRAY_TYPE \
+ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
+ && (ALIGN) < BITS_PER_WORD) ? BITS_PER_WORD : (ALIGN)))
/* Nonzero if move instructions will actually fail to work
when given unaligned data. */
next reply other threads:[~2009-09-11 1:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 1:18 Nathan Froyd [this message]
2009-09-11 2:03 ` 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=20090911005122.GT32063@codesourcery.com \
--to=froydnj@codesourcery.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/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).