libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / pr110279-1.c
bloba8c7257b28d320bab9249147fe854d1df3b03972
1 /* { dg-do compile } */
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*-*-* } } */
7 #define LOOP_COUNT 800000000
8 typedef double data_e;
10 /* Check that FMAs with backedge dependency are avoided. Otherwise there won't
11 be FMA generated with "--param avoid-fma-max-bits=512". */
13 data_e
14 foo1 (data_e a, data_e b, data_e c, data_e d)
16 data_e result = 0;
18 for (int ic = 0; ic < LOOP_COUNT; ic++)
20 result += (a * b + c * d);
22 a -= 0.1;
23 b += 0.9;
24 c *= 1.02;
25 d *= 0.61;
28 return result;
31 data_e
32 foo2 (data_e a, data_e b, data_e c, data_e d)
34 data_e result = 0;
36 for (int ic = 0; ic < LOOP_COUNT; ic++)
38 result = a * b + result + c * d;
40 a -= 0.1;
41 b += 0.9;
42 c *= 1.02;
43 d *= 0.61;
46 return result;
49 data_e
50 foo3 (data_e a, data_e b, data_e c, data_e d)
52 data_e result = 0;
54 for (int ic = 0; ic < LOOP_COUNT; ic++)
56 result = result + a * b + c * d;
58 a -= 0.1;
59 b += 0.9;
60 c *= 1.02;
61 d *= 0.61;
64 return result;
67 /* { dg-final { scan-tree-dump-times "Generated FMA" 3 "widening_mul"} } */