gcc/testsuite/gcc.dg/vect/vect-cond-reduc-1.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-require-effective-target vect_int } */ |
| 3 | /* { dg-require-effective-target vect_condition } */ |
| 4 | |
| 5 | #define N 512 |
| 6 | int a[N]; |
| 7 | int foo() |
| 8 | { |
| 9 | int i, res = 0; |
| 10 | for (i=0; i<N; i++) |
| 11 | { |
| 12 | if (a[i] != 0) |
| 13 | res += 1; |
| 14 | } |
| 15 | return res; |
| 16 | } |
| 17 | |
| 18 | /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 19 |