This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR target/27006 (wrong Altivec vector initialization code)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 Apr 2006 13:45:37 +0200 (CEST)
- Subject: [PATCH] Fix PR target/27006 (wrong Altivec vector initialization code)
Hello,
this patch fixes PR target/27006, a wrong-code bug in Altivec
vector initialization. See the PR for details.
Bootstrapped/regtested on powerpc64-linux.
OK for head and 4.1?
Bye,
Ulrich
2006-04-06 Paolo Bonzini <bonzini@gnu.org>
Ulrich Weigand <uweigand@de.ibm.com>
* config/rs6000/rs6000.h (EASY_VECTOR_15_ADD_SELF): Require n
to be even.
* gcc.dg/vmx/pr27006.c: New testcase.
Index: gcc/config/rs6000/rs6000.h
===================================================================
*** gcc/config/rs6000/rs6000.h (revision 112917)
--- gcc/config/rs6000/rs6000.h (working copy)
*************** typedef struct rs6000_args
*** 1598,1604 ****
#define EASY_VECTOR_15(n) ((n) >= -16 && (n) <= 15)
#define EASY_VECTOR_15_ADD_SELF(n) (!EASY_VECTOR_15((n)) \
! && EASY_VECTOR_15((n) >> 1))
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
and check its validity for a certain class.
--- 1598,1605 ----
#define EASY_VECTOR_15(n) ((n) >= -16 && (n) <= 15)
#define EASY_VECTOR_15_ADD_SELF(n) (!EASY_VECTOR_15((n)) \
! && EASY_VECTOR_15((n) >> 1) \
! && ((n) & 1) == 0)
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
and check its validity for a certain class.
*** /dev/null Tue Oct 26 21:02:43 2004
--- gcc/testsuite/gcc.dg/vmx/pr27006.c Thu Apr 13 13:33:35 2006
***************
*** 0 ****
--- 1,23 ----
+ /* { dg-do run */
+ /* { dg-options "-maltivec" } */
+
+ extern void abort ();
+
+ typedef union
+ {
+ int i[4];
+ __attribute__((altivec(vector__))) int v;
+ } vec_int4;
+
+ int main (void)
+ {
+ vec_int4 i1;
+
+ i1.v = (__attribute__((altivec(vector__))) int){31, 31, 31, 31};
+
+ if (i1.i[0] != 31)
+ abort ();
+
+ return 0;
+ }
+
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com