Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / pr43430-1.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 typedef int myint;
9 myint data_ch1[N + 1] =
10   { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 };
11 myint data_ch2[N + 1] =
12   { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 };
13 #define SUM 480
14
15 __attribute__ ((noinline)) int
16 foo (myint * s1, myint * s2, int stride)
17 {
18   int score = 0;
19   int x;
20   for (x = 0; x < N; x++)
21     score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
22               s1[x] + s2[x + stride] :
23               s2[x + stride]);
24
25   if (score != SUM)
26     abort ();
27
28   return 0;
29 }
30
31 int
32 main (void)
33 {
34   check_vect ();
35   return foo (data_ch1, data_ch2, 1);
36 }
37
38 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */
39 /* { dg-final { cleanup-tree-dump "vect" } } */