Debian Codegraph @

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

raw
1 /* { dg-do compile { target { scalar_all_fma || { i?86-*-* x86_64-*-* } } } } */
2 /* { dg-options "-Ofast --param avoid-fma-max-bits=512 --param tree-reassoc-width=4 -fdump-tree-widening_mul-details" } */
3 /* { dg-additional-options "-mcpu=generic" { target aarch64*-*-* } } */
4 /* { dg-additional-options "-mfma" { target i?86-*-* x86_64-*-* } } */
5 /* { dg-additional-options "-march=2.0" { target hppa*-*-* } } */
6
7 #define LOOP_COUNT 800000000
8 typedef double data_e;
9
10 /* Check that FMAs with backedge dependency are avoided. Otherwise there won't
11 be FMA generated with "--param avoid-fma-max-bits=512". */
12
13 data_e
14 foo1 (data_e a, data_e b, data_e c, data_e d)
15 {
16 data_e result = 0;
17
18 for (int ic = 0; ic < LOOP_COUNT; ic++)
19 {
20 result += (a * b + c * d);
21
22 a -= 0.1;
23 b += 0.9;
24 c *= 1.02;
25 d *= 0.61;
26 }
27
28 return result;
29 }
30
31 data_e
32 foo2 (data_e a, data_e b, data_e c, data_e d)
33 {
34 data_e result = 0;
35
36 for (int ic = 0; ic < LOOP_COUNT; ic++)
37 {
38 result = a * b + result + c * d;
39
40 a -= 0.1;
41 b += 0.9;
42 c *= 1.02;
43 d *= 0.61;
44 }
45
46 return result;
47 }
48
49 data_e
50 foo3 (data_e a, data_e b, data_e c, data_e d)
51 {
52 data_e result = 0;
53
54 for (int ic = 0; ic < LOOP_COUNT; ic++)
55 {
56 result = result + a * b + c * d;
57
58 a -= 0.1;
59 b += 0.9;
60 c *= 1.02;
61 d *= 0.61;
62 }
63
64 return result;
65 }
66
67 /* { dg-final { scan-tree-dump-times "Generated FMA" 3 "widening_mul" } } */