Debian Codegraph @

gcc/testsuite/gcc.dg/pr110279-2.c

raw
1 /* PR tree-optimization/110279 */
2 /* { dg-do compile } */
3 /* { dg-options "-Ofast --param tree-reassoc-width=4 --param fully-pipelined-fma=1 -fdump-tree-reassoc2-details -fdump-tree-optimized" } */
4 /* { dg-additional-options "-mcpu=generic" { target aarch64*-*-* } } */
5
6 #define LOOP_COUNT 800000000
7 typedef double data_e;
8
9 data_e
10 foo (data_e in)
11 {
12 data_e a1, a2, a3, a4;
13 data_e tmp, result = 0;
14 a1 = in + 0.1;
15 a2 = in * 0.1;
16 a3 = in + 0.01;
17 a4 = in * 0.59;
18
19 data_e result2 = 0;
20
21 for (int ic = 0; ic < LOOP_COUNT; ic++)
22 {
23 /* Test that a complete FMA chain with length=4 is not broken. */
24 tmp = a1 + a2 * a2 + a3 * a3 + a4 * a4 ;
25 result += tmp - ic;
26 result2 = result2 / 2 - tmp;
27
28 a1 += 0.91;
29 a2 += 0.1;
30 a3 -= 0.01;
31 a4 -= 0.89;
32
33 }
34
35 return result + result2;
36 }
37
38 /* { dg-final { scan-tree-dump-not "was chosen for reassociation" "reassoc2" { target aarch64*-*-* }} } */
39 /* { dg-final { scan-tree-dump-times {\.FMA } 3 "optimized" { target aarch64*-*-* }} } */