1 /* { dg-require-effective-target vect_float } */ 2 3 #include <stdarg.h> 4 #include "tree-vect.h" 5 6 #define N 128 7 8 float results1[N]; 9 float results2[N]; 10 float a[N] = {0}; 11 float e[N] = {0}; 12 float b[N]; 13 float c[N]; 14 15 __attribute__ ((noinline)) main1()16int main1 () 17 { 18 int i; 19 20 for (i=0; i<N; i++) 21 { 22 b[i] = i*3; 23 c[i] = i; 24 results1[i] = 0; 25 results2[i] = 0; 26 asm volatile ("" ::: "memory"); 27 } 28 for (i=0; i<N/2; i++) 29 { 30 results1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i]; 31 results2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i]; 32 asm volatile ("" ::: "memory"); 33 } 34 35 for (i = 0; i < N/2; i++) 36 { 37 a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i]; 38 e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i]; 39 } 40 41 /* check results: */ 42 for (i=0; i<N; i++) 43 { 44 if (a[i] != results1[i] || e[i] != results2[i]) 45 abort (); 46 } 47 48 49 for (i = 1; i <=N-4; i++) 50 { 51 a[i+3] = b[i-1]; 52 } 53 54 /* check results: */ 55 for (i = 1; i <=N-4; i++) 56 { 57 if (a[i+3] != b[i-1]) 58 abort (); 59 } 60 61 return 0; 62 } 63 main(void)64int main (void) 65 { 66 check_vect (); 67 68 return main1 (); 69 } 70 71 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ 72 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ 73 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ 74