aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr32912-1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-08-21 11:22:14 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-08-21 11:22:14 +0200
commitc01ee93565332d96080cdfecaa32827d0c7fa623 (patch)
treee69367431695e71d8953aafa59574d63eb548731 /gcc/testsuite/gcc.dg/pr32912-1.c
parentf7d1e0c6cb12146eaddeac1386e1a5b9394f5955 (diff)
downloadgcc-c01ee93565332d96080cdfecaa32827d0c7fa623.zip
gcc-c01ee93565332d96080cdfecaa32827d0c7fa623.tar.gz
gcc-c01ee93565332d96080cdfecaa32827d0c7fa623.tar.bz2
re PR middle-end/32912 (ICE with vector code)
PR middle-end/32912 * fold-const.c (fold_unary): Optimize BIT_NOT_EXPR of VECTOR_CST. (fold_binary): Handle vectors in X | ~X and X ^ ~X optimizations. * gcc.dg/pr32912-1.c: New test. * gcc.dg/pr32912-2.c: New test. * gcc.dg/pr32912-3.c: New test. From-SVN: r127661
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr32912-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr32912-1.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr32912-1.c b/gcc/testsuite/gcc.dg/pr32912-1.c
new file mode 100644
index 0000000..7526ee1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr32912-1.c
@@ -0,0 +1,44 @@
+/* PR middle-end/32912 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+typedef int __m128i __attribute__ ((__vector_size__ (16)));
+
+__m128i a, b, c, d, e, f;
+
+void
+foo (__m128i x)
+{
+ a = x ^ ~x;
+ b = ~x ^ x;
+ c = x | ~x;
+ d = ~x | x;
+ e = x & ~x;
+ f = ~x & x;
+}
+
+int
+main (void)
+{
+ union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u;
+ int i;
+
+ for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++)
+ u.i[i] = i * 49 - 36;
+ foo (u.v);
+#define check(x, val) \
+ u.v = (x); \
+ for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++) \
+ if (u.i[i] != (val)) \
+ abort ()
+
+ check (a, ~0);
+ check (b, ~0);
+ check (c, ~0);
+ check (d, ~0);
+ check (e, 0);
+ check (f, 0);
+ return 0;
+}