1 /* { dg-require-effective-target vect_float } */ 2 3 #include "tree-vect.h" 4 5 extern void abort (void); 6 7 #define OP * 8 #define INIT 1.0 9 10 float __attribute__((noinline,noclone)) foo(float * __restrict__ i)11foo (float *__restrict__ i) 12 { 13 float l = INIT; 14 int a; 15 int b; 16 17 for (a = 0; a < 4; a++) 18 for (b = 0; b < 4; b++) 19 l = l OP i[b]; 20 21 return l; 22 } 23 24 float __attribute__((noinline,noclone)) foo_ref(float * __restrict__ i)25foo_ref (float *__restrict__ i) 26 { 27 float l = INIT; 28 29 l = l OP i[0]; 30 l = l OP i[1]; 31 l = l OP i[2]; 32 l = l OP i[3]; 33 34 l = l OP i[0]; 35 l = l OP i[1]; 36 l = l OP i[2]; 37 l = l OP i[3]; 38 39 l = l OP i[0]; 40 l = l OP i[1]; 41 l = l OP i[2]; 42 l = l OP i[3]; 43 44 l = l OP i[0]; 45 l = l OP i[1]; 46 l = l OP i[2]; 47 l = l OP i[3]; 48 49 return l; 50 } 51 52 union u 53 { 54 float f; 55 unsigned int u; 56 }; 57 58 int main(void)59main (void) 60 { 61 union u res, res2; 62 float a[4]; 63 64 if (sizeof (float) != sizeof (unsigned int)) 65 return 0; 66 67 check_vect (); 68 69 a[0] = 0.01; 70 a[1] = 0.01; 71 a[2] = 0.01; 72 a[3] = 1.0; 73 74 res.f = foo_ref (a); 75 76 res2.f = foo (a); 77 78 if (res.u != res2.u) 79 abort (); 80 81 return 0; 82 } 83 84 /* need -ffast-math to vectorize this loop. */ 85 /* ARM NEON passes -ffast-math to these tests, so expect this to fail. */ 86 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail arm_neon_ok } } } */ 87