gcc/testsuite/gcc.dg/vect/vect-cond-reduc-5.c
raw| 1 | #include "tree-vect.h" |
| 2 | |
| 3 | #define N 512 |
| 4 | |
| 5 | int a[N], b[N]; |
| 6 | |
| 7 | int __attribute__((noipa)) |
| 8 | foo (int aval, int bval) |
| 9 | { |
| 10 | int i, res = 0; |
| 11 | for (i=0; i<N; i++) |
| 12 | { |
| 13 | if (a[i] != 0) |
| 14 | res = aval; |
| 15 | if (b[i] != 0) |
| 16 | res = bval; |
| 17 | } |
| 18 | return res; |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | check_vect (); |
| 24 | if (foo (1, 2) != 0) |
| 25 | abort (); |
| 26 | a[3] = 1; |
| 27 | b[4] = 1; |
| 28 | if (foo (1, 2) != 2) |
| 29 | abort (); |
| 30 | a[7] = 1; |
| 31 | if (foo (1, 2) != 1) |
| 32 | abort (); |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */ |