LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-in-order-2.c
blob3b4c68aa8d13dbb40a30746517a12dc7428e2b38
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" } */
6 #include "tree-vect.h"
8 #define N (VECTOR_BITS * 17)
10 double __attribute__ ((noinline, noclone))
11 reduc_plus_double (double *restrict a, int n)
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;
20 int __attribute__ ((optimize (1)))
21 main ()
23 int n = 19;
24 double a[N];
25 double r = 0;
26 for (int i = 0; i < N; i++)
28 a[i] = (i * 0.1) * (i & 1 ? 1 : -1);
29 asm volatile ("" ::: "memory");
31 for (int i = 0; i < n; i++)
32 for (int j = 0; j < N; j++)
34 r += a[i];
35 asm volatile ("" ::: "memory");
37 double res = reduc_plus_double (a, n);
38 if (res != r)
39 __builtin_abort ();
40 return 0;
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" } } */