From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4247 invoked by alias); 11 Sep 2009 01:18:16 -0000 Received: (qmail 4235 invoked by uid 22791); 11 Sep 2009 01:18:15 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from mx20.gnu.org (HELO mx20.gnu.org) (199.232.41.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Sep 2009 01:18:10 +0000 Received: from [65.74.133.4] (helo=mail.codesourcery.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mlum8-0002dL-Lu for gcc-patches@gcc.gnu.org; Thu, 10 Sep 2009 21:18:08 -0400 Received: (qmail 16909 invoked from network); 11 Sep 2009 00:51:22 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Sep 2009 00:51:22 -0000 Date: Fri, 11 Sep 2009 01:18:00 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Subject: [PATCH] fix ICEs for powerpc-linux-gnuspe configs Message-ID: <20090911005122.GT32063@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00771.txt.bz2 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 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 * 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. */