gcc/testsuite/gcc.dg/vect/vect-nest-cycle-2.c
raw| 1 | /* { dg-require-effective-target vect_float } */ |
| 2 | |
| 3 | #include <stdarg.h> |
| 4 | #include "tree-vect.h" |
| 5 | |
| 6 | #define N 16 |
| 7 | |
| 8 | float out[N]; |
| 9 | float check_res[N] = {880,864,848,832,816,800,784,768,752,736,720,704,688,672,656,640}; |
| 10 | float a[2*N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; |
| 11 | |
| 12 | /* Outer-loop vectorization. */ |
| 13 | |
| 14 | __attribute__ ((noinline)) void |
| 15 | foo () |
| 16 | { |
| 17 | int i, j; |
| 18 | float res; |
| 19 | |
| 20 | for (i = 0; i < N; i++) |
| 21 | { |
| 22 | res = 1000; |
| 23 | |
| 24 | for (j = 0; j < N; j++) |
| 25 | res = res - a[i+j]; |
| 26 | |
| 27 | out[i] = res; |
| 28 | } |
| 29 | |
| 30 | #pragma GCC novector |
| 31 | for (i = 0; i < N; i++) |
| 32 | if (out[i] != check_res[i]) |
| 33 | abort (); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | int main () |
| 38 | { |
| 39 | check_vect (); |
| 40 | |
| 41 | foo(); |
| 42 | |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ |
| 47 |