aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vshift-1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-10-28 12:28:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-10-28 12:28:40 +0200
commitee3b466d6584e531f0739a5d51ee7c8fc8af6bb5 (patch)
tree19e42a84a5ec5ece294d2fbe5d30e7f1d07038e9 /gcc/testsuite/gcc.dg/vshift-1.c
parentef6f874e5c574ba301d2498150e5432ec89668b6 (diff)
downloadgcc-ee3b466d6584e531f0739a5d51ee7c8fc8af6bb5.zip
gcc-ee3b466d6584e531f0739a5d51ee7c8fc8af6bb5.tar.gz
gcc-ee3b466d6584e531f0739a5d51ee7c8fc8af6bb5.tar.bz2
sse.md (VI4SD_AVX2): Removed.
* config/i386/sse.md (VI4SD_AVX2): Removed. (VI48_AVX2, VI128_128, VI48_128, VI48_256): New mode iterators. (vashl<mode>3): Use VI12_128 iterator instead of VI124_128. Add another expander using VI48_128 iterator for TARGET_AVX2 || TARGET_XOP and another using VI48_256 iterator for TARGET_AVX2. (vlshr<mode>3): Likewise. Change register_operand predicate to nonimmediate_operand on last operand in the VI12_128 expander. (vashr<mode>3): Use VI128_128 iterator instead of VI124_128. (vashrv4si3, vashrv8si3): New expanders. (avx2_ashrvv8si, avx2_ashrvv4si, avx2_<lshift>vv8si, avx2_<lshift>vv2di): Removed. (avx2_ashrv<mode>): New insn with VI4_AVX2 iterator. (avx2_<lshift>v<mode>): Macroize using VI48_AVX2 iterator. Simplify pattern. * gcc.dg/vshift-1.c: New test. * gcc.dg/vshift-2.c: New test. * gcc.target/i386/xop-vshift-1.c: New test. * gcc.target/i386/xop-vshift-2.c: New test. * gcc.target/i386/avx2-vshift-1.c: New test. From-SVN: r180609
Diffstat (limited to 'gcc/testsuite/gcc.dg/vshift-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/vshift-1.c132
1 files changed, 132 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vshift-1.c b/gcc/testsuite/gcc.dg/vshift-1.c
new file mode 100644
index 0000000..2a237aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vshift-1.c
@@ -0,0 +1,132 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+#include <stdlib.h>
+
+#define N 64
+
+#ifndef TYPE1
+#define TYPE1 int
+#define TYPE2 long long
+#endif
+
+signed TYPE1 a[N], b[N], g[N];
+unsigned TYPE1 c[N], h[N];
+signed TYPE2 d[N], e[N], j[N];
+unsigned TYPE2 f[N], k[N];
+
+__attribute__((noinline)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ g[i] = a[i] << b[i];
+}
+
+__attribute__((noinline)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ g[i] = a[i] >> b[i];
+}
+
+__attribute__((noinline)) void
+f3 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ h[i] = c[i] >> b[i];
+}
+
+__attribute__((noinline)) void
+f4 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ j[i] = d[i] << e[i];
+}
+
+__attribute__((noinline)) void
+f5 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ j[i] = d[i] >> e[i];
+}
+
+__attribute__((noinline)) void
+f6 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ k[i] = f[i] >> e[i];
+}
+
+__attribute__((noinline)) void
+f7 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ j[i] = d[i] << b[i];
+}
+
+__attribute__((noinline)) void
+f8 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ j[i] = d[i] >> b[i];
+}
+
+__attribute__((noinline)) void
+f9 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ k[i] = f[i] >> b[i];
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ asm ("");
+ c[i] = (random () << 1) | (random () & 1);
+ b[i] = (i * 85) & (sizeof (TYPE1) * __CHAR_BIT__ - 1);
+ a[i] = c[i];
+ d[i] = (random () << 1) | (random () & 1);
+ d[i] |= (unsigned long long) c[i] << 32;
+ e[i] = (i * 85) & (sizeof (TYPE2) * __CHAR_BIT__ - 1);
+ f[i] = d[i];
+ }
+ f1 ();
+ f3 ();
+ f4 ();
+ f6 ();
+ for (i = 0; i < N; i++)
+ if (g[i] != (signed TYPE1) (a[i] << b[i])
+ || h[i] != (unsigned TYPE1) (c[i] >> b[i])
+ || j[i] != (signed TYPE2) (d[i] << e[i])
+ || k[i] != (unsigned TYPE2) (f[i] >> e[i]))
+ abort ();
+ f2 ();
+ f5 ();
+ f9 ();
+ for (i = 0; i < N; i++)
+ if (g[i] != (signed TYPE1) (a[i] >> b[i])
+ || j[i] != (signed TYPE2) (d[i] >> e[i])
+ || k[i] != (unsigned TYPE2) (f[i] >> b[i]))
+ abort ();
+ f7 ();
+ for (i = 0; i < N; i++)
+ if (j[i] != (signed TYPE2) (d[i] << b[i]))
+ abort ();
+ f8 ();
+ for (i = 0; i < N; i++)
+ if (j[i] != (signed TYPE2) (d[i] >> b[i]))
+ abort ();
+ return 0;
+}