* [PATCH] fix ICEs for powerpc-linux-gnuspe configs
@ 2009-09-11 1:18 Nathan Froyd
2009-09-11 2:03 ` David Edelsohn
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2009-09-11 1:18 UTC (permalink / raw)
To: gcc-patches; +Cc: dje.gcc
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. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fix ICEs for powerpc-linux-gnuspe configs
2009-09-11 1:18 [PATCH] fix ICEs for powerpc-linux-gnuspe configs Nathan Froyd
@ 2009-09-11 2:03 ` David Edelsohn
0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2009-09-11 2:03 UTC (permalink / raw)
To: Nathan Froyd; +Cc: gcc-patches
On Thu, Sep 10, 2009 at 8:51 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
>
> 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.
Okay.
Thanks, David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-11 2:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-11 1:18 [PATCH] fix ICEs for powerpc-linux-gnuspe configs Nathan Froyd
2009-09-11 2:03 ` David Edelsohn
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).