gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c
raw| 1 | /* Test for pr30485. */ |
| 2 | /* { dg-require-effective-target vect_float } */ |
| 3 | |
| 4 | #include <stdarg.h> |
| 5 | #include "tree-vect.h" |
| 6 | |
| 7 | #define N 16 |
| 8 | |
| 9 | float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 10 | |
| 11 | __attribute__ ((noinline)) int |
| 12 | main1 (void) |
| 13 | { |
| 14 | int i; |
| 15 | float a[N]; |
| 16 | |
| 17 | /* Condition in loop. */ |
| 18 | /* This loop is vectorized on platforms that support vect_condition. */ |
| 19 | for (i = 0; i < N; i++) |
| 20 | { |
| 21 | a[i] = (b[i] > 0 ? b[i] : 0); |
| 22 | } |
| 23 | |
| 24 | #pragma GCC novector |
| 25 | for (i = 0; i < N; i++) |
| 26 | { |
| 27 | if (a[i] != b[i]) |
| 28 | abort (); |
| 29 | } |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | int main (void) |
| 34 | { |
| 35 | check_vect (); |
| 36 | return main1 (); |
| 37 | } |
| 38 | |
| 39 | /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */ |