summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-12 09:48:08 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-12 09:48:08 +0000
commita08c9086662af01e9b45c14a9254a9f8c8ed2c57 (patch)
treee100d0deea8e73f61b639ceca819feeedad88a45 /gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
parent30be4b5bc2781a437162c35b2d95672ce77cc6c5 (diff)
downloadgcc-a08c9086662af01e9b45c14a9254a9f8c8ed2c57.tar.gz
2011-12-12 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 182221 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@182223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
new file mode 100644
index 00000000000..7462cb34cc5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
@@ -0,0 +1,71 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 256
+
+unsigned char ub[N];
+unsigned char uc[N];
+unsigned char diff;
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) void
+main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
+{
+ int i;
+ unsigned char udiff = 2;
+ unsigned char umax = x;
+ unsigned char umin = x;
+
+ diff = 2;
+ for (i = 0; i < N; i++) {
+ ub[i] = i;
+ uc[i] = i;
+ if (i%16 == 0)
+ {
+ ub[i] = i+2;
+ diff += 2;
+ }
+ if (uc[i] > max_result)
+ max_result = uc[i];
+ if (uc[i] < min_result)
+ min_result = uc[i];
+
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+ for (i = 0; i < N; i++) {
+ udiff += (unsigned char) (ub[i] - uc[i]);
+ }
+
+ for (i = 0; i < N; i++) {
+ umax = umax < uc[i] ? uc[i] : umax;
+ }
+
+ for (i = 0; i < N; i++) {
+ umin = umin > uc[i] ? uc[i] : umin;
+ }
+
+ /* check results: */
+ if (udiff != diff)
+ abort ();
+ if (umax != max_result)
+ abort ();
+ if (umin != 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 vect_no_int_max } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */