[testcase] Fix PR35907, vmx regs trashed
Jakub Jelinek
jakub@redhat.com
Thu Apr 17 14:35:00 GMT 2008
Hi!
On Wed, Apr 16, 2008 at 08:21:04PM -0400, David Edelsohn wrote:
> The patch is fine. Thanks for detangling this!
The patch was committed without a testcase, is this ok for trunk/4.3?
Regtested on both:
2008-04-17 Jakub Jelinek <jakub@redhat.com>
Peter Bergner <bergner@vnet.ibm.com>
PR target/35907
* gcc.target/powerpc/pr35907.c: New test.
--- gcc/testsuite/gcc.target/powerpc/pr35907.c.jj 2008-04-16 10:04:23.000000000 +0200
+++ gcc/testsuite/gcc.target/powerpc/pr35907.c 2008-04-16 10:04:58.000000000 +0200
@@ -0,0 +1,59 @@
+/* PR target/35907 */
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O2 -maltivec" } */
+
+#include "altivec_check.h"
+
+#define vector __attribute__((vector_size (16)))
+union
+{
+ vector int k;
+ int c[16];
+} u, v, w;
+vector int m;
+
+void __attribute__((noinline))
+bar (void *i, vector int j)
+{
+ asm volatile ("" : : "r" (i), "r" (&j) : "memory");
+}
+
+int __attribute__((noinline))
+foo (int i, vector int j)
+{
+ char *p = __builtin_alloca (64 + i);
+ m += u.k;
+ v.k = m;
+ w.k = j;
+ if (__builtin_memcmp (&v.c, &w.c, 16) != 0)
+ __builtin_abort ();
+ j += u.k;
+ bar (p, j);
+ j += u.k;
+ bar (p, j);
+ return 0;
+}
+
+void
+test (void)
+{
+ vector int l;
+ int i;
+ for (i = 0; i < 4; i++)
+ u.c[i] = i;
+ l = u.k;
+ if (foo (64, l))
+ __builtin_abort ();
+ l += u.k;
+ if (foo (64, l))
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ altivec_check ();
+ test ();
+ return 0;
+}
Jakub
More information about the Gcc-patches
mailing list