1 /* { dg-xfail-run-if "" { { i?86-*-* x86_64-*-* } && ia32 } } */ 2 /* { dg-require-effective-target vect_double } */ 3 /* { dg-add-options ieee } */ 4 /* { dg-additional-options "-fno-fast-math" } */ 5 6 #include "tree-vect.h" 7 8 #define N (VECTOR_BITS * 17) 9 10 double __attribute__ ((noinline, noclone)) reduc_plus_double(double * restrict a,int n)11reduc_plus_double (double *restrict a, int n) 12 { 13 double res = 0.0; 14 for (int i = 0; i < n; i++) 15 for (int j = 0; j < N; j++) 16 res += a[i]; 17 return res; 18 } 19 20 int __attribute__ ((optimize (1))) main()21main () 22 { 23 int n = 19; 24 double a[N]; 25 double r = 0; 26 for (int i = 0; i < N; i++) 27 { 28 a[i] = (i * 0.1) * (i & 1 ? 1 : -1); 29 asm volatile ("" ::: "memory"); 30 } 31 for (int i = 0; i < n; i++) 32 for (int j = 0; j < N; j++) 33 { 34 r += a[i]; 35 asm volatile ("" ::: "memory"); 36 } 37 double res = reduc_plus_double (a, n); 38 if (res != r) 39 __builtin_abort (); 40 return 0; 41 } 42 43 /* { dg-final { scan-tree-dump {in-order double reduction not supported} "vect" } } */ 44 /* { dg-final { scan-tree-dump-times {using an in-order \(fold-left\) reduction} 1 "vect" } } */ 45