PR c/6290
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Apr 2002 22:39:10 +0000 (22:39 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Apr 2002 22:39:10 +0000 (22:39 +0000)
* config/rs6000/rs6000.c (easy_vector_constant): Return 1 if the
CONST_VECTOR is { 0, ... 0 }.

* gcc.dg/altivec-5.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52340 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/altivec-5.c [new file with mode: 0644]

index bb849b8..915a13c 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/6290
+       * config/rs6000/rs6000.c (easy_vector_constant): Return 1 if the
+       CONST_VECTOR is { 0, ... 0 }.
+
 2002-04-15  Loren J. Rittle  <ljrittle@acm.org>
 
        * doc/install.texi (Installing GCC: Configuration): Clarify
index 99e7af6..0409810 100644 (file)
@@ -1219,18 +1219,24 @@ easy_vector_constant (op)
         with CONST0_RTX for the current mode, but let's be safe
         instead.  */
 
-      if (GET_CODE (elt) == CONST_INT && INTVAL (elt) != 0)
-       return 0;
-
-      if (GET_CODE (elt) == CONST_DOUBLE
-              && (CONST_DOUBLE_LOW (elt) != 0
-                  || CONST_DOUBLE_HIGH (elt) != 0))
-       return 0;
+      switch (GET_CODE (elt))
+       {
+       case CONST_INT:
+         if (INTVAL (elt) != 0)
+           return 0;
+         break;
+       case CONST_DOUBLE:
+         if (CONST_DOUBLE_LOW (elt) != 0 || CONST_DOUBLE_HIGH (elt) != 0)
+           return 0;
+         break;
+       default:
+         return 0;
+       }
     }
 
   /* We could probably generate a few other constants trivially, but
      gcc doesn't generate them yet.  FIXME later.  */
-  return 0;
+  return 1;
 }
 
 /* Return 1 if the operand is the constant 0.  This works for scalars
index 4fa62b3..f5f8515 100644 (file)
@@ -1,3 +1,7 @@
+2002-04-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/altivec-5.c: New test.
+
 2002-04-15  Mark Mitchell  <mark@codesourcery.com>
 
        * testsuite/lib/chill.exp: Remove.
diff --git a/gcc/testsuite/gcc.dg/altivec-5.c b/gcc/testsuite/gcc.dg/altivec-5.c
new file mode 100644 (file)
index 0000000..61d19d9
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target powerpc-*-* } } */
+/* { dg-options "-maltivec -O2" } */
+
+#define vector __attribute__((vector_size(16)))
+
+void foo (const unsigned long x,
+         vector signed int a, vector signed int b)
+{
+  unsigned char d[64];
+
+  __builtin_altivec_stvewx (b, 0, d);
+}