vect-shift-3.c, [...]: New.
authorDaniel Jacobowitz <dan@codesourcery.com>
Wed, 20 Apr 2011 16:39:37 +0000 (16:39 +0000)
committerAndrew Stubbs <ams@gcc.gnu.org>
Wed, 20 Apr 2011 16:39:37 +0000 (16:39 +0000)
2011-04-20  Daniel Jacobowitz  <dan@codesourcery.com>

gcc/testsuite/
* gcc.dg/vect/vect-shift-3.c, gcc.dg/vect/vect-shift-4.c: New.
* lib/target-supports.exp (check_effective_target_vect_shift_char): New
function.

From-SVN: r172778

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-shift-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect-shift-4.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index 95646de029a4d1cd2e2329adad5541def286bc05..3528f3e43c2559a0decec3ea94b6c0a25497ed95 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-20  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gcc.dg/vect/vect-shift-3.c, gcc.dg/vect/vect-shift-4.c: New.
+       * lib/target-supports.exp (check_effective_target_vect_shift_char): New
+       function.
+
 2011-04-20  Kai Tietz  <ktietz@redhat.com>
 
        * gcc.dg/binio-xor1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-3.c b/gcc/testsuite/gcc.dg/vect/vect-shift-3.c
new file mode 100644 (file)
index 0000000..78ed935
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned short dst[N] __attribute__((aligned(N)));
+unsigned short src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+  int i;
+  for (i = 0; i < N; i++)
+    dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+  volatile int i;
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+    src[i] = i << 3;
+
+  array_shift ();
+
+  for (i = 0; i < N; i++)
+    if (dst[i] != i)
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-4.c b/gcc/testsuite/gcc.dg/vect/vect-shift-4.c
new file mode 100644 (file)
index 0000000..e705fea
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift_char } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned char dst[N] __attribute__((aligned(N)));
+unsigned char src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+  int i;
+  for (i = 0; i < N; i++)
+    dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+  volatile int i;
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+    src[i] = i << 3;
+
+  array_shift ();
+
+  for (i = 0; i < N; i++)
+    if (dst[i] != i)
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 3df2a5c94a2b85bfbde5ac10f06521341aa385fe..c7e1280e782c850ab078247bdfe50717c1049681 100644 (file)
@@ -2310,6 +2310,26 @@ proc check_effective_target_vect_shift_scalar { } {
 }
 
 
+# Return 1 if the target supports hardware vector shift operation for char.
+
+proc check_effective_target_vect_shift_char { } {
+    global et_vect_shift_char_saved
+
+    if [info exists et_vect_shift_char_saved] {
+       verbose "check_effective_target_vect_shift_char: using cached result" 2
+    } else {
+       set et_vect_shift_char_saved 0
+       if { ([istarget powerpc*-*-*]
+             && ![istarget powerpc-*-linux*paired*])
+            || [check_effective_target_arm32] } {
+          set et_vect_shift_char_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
+    return $et_vect_shift_char_saved
+}
+
 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
 #
 # This can change for different subtargets so do not cache the result.