comparison gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
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))
11 reduc_plus_double (double *a)
12 {
13 double r1 = 0;
14 double r2 = 0;
15 double r3 = 0;
16 double r4 = 0;
17 for (int i = 0; i < N; i += 4)
18 {
19 r1 += a[i];
20 r2 += a[i + 1];
21 r3 += a[i + 2];
22 r4 += a[i + 3];
23 }
24 return r1 * r2 * r3 * r4;
25 }
26
27 int __attribute__ ((optimize (1)))
28 main ()
29 {
30 double a[N];
31 double r[4] = {};
32 for (int i = 0; i < N; i++)
33 {
34 a[i] = (i * 0.1) * (i & 1 ? 1 : -1);
35 r[i % 4] += a[i];
36 asm volatile ("" ::: "memory");
37 }
38 double res = reduc_plus_double (a);
39 if (res != r[0] * r[1] * r[2] * r[3])
40 __builtin_abort ();
41 return 0;
42 }
43
44 /* { dg-final { scan-tree-dump {in-order unchained SLP reductions not supported} "vect" } } */
45 /* { dg-final { scan-tree-dump-not {vectorizing stmts using SLP} "vect" } } */