summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
new file mode 100644
index 00000000000..7004e9e4e44
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
@@ -0,0 +1,69 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 256
+volatile int y = 0;
+
+__attribute__ ((noinline))
+void main1 (signed char x, signed char max_result, signed char min_result)
+{
+ int i;
+ signed char b[N];
+ signed char c[N];
+ signed char check_diff = 2;
+ signed char diff = 2;
+ signed char max = x;
+ signed char min = x;
+
+ check_diff = 2;
+ for (i = 0; i < N; i++) {
+ b[i] = i;
+ c[i] = i;
+ if (i%16 == 0)
+ {
+ c[i] = i + 1;
+ check_diff += 1;
+ }
+ if (c[i] > max_result)
+ max_result = c[i];
+ if (c[i] < min_result)
+ min_result = c[i];
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++) {
+ diff += (signed char) (c[i] - b[i]);
+ }
+
+ for (i = 0; i < N; i++) {
+ max = max < c[i] ? c[i] : max;
+ }
+
+ for (i = 0; i < N; i++) {
+ min = min > c[i] ? c[i] : min;
+ }
+
+ /* check results: */
+ if (diff != check_diff)
+ abort ();
+ if (max != max_result)
+ abort ();
+ if (min != min_result)
+ abort ();
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (100, 100, 1);
+ main1 (0, 15, 0);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */