1 /* Verify that the fsca input value is not converted to float and then back
2 to int. Notice that we can't count just "lds" insns because mode switches
4 /* { dg-do compile { target { has_fsca } } } */
5 /* { dg-options "-O2 -mfsca -funsafe-math-optimizations -fno-ipa-icf" } */
6 /* { dg-final { scan-assembler-times "fsca" 7 } } */
7 /* { dg-final { scan-assembler-times "shad" 1 } } */
8 /* { dg-final { scan-assembler-times "lds\tr\[0-9\],fpul" 6 } } */
9 /* { dg-final { scan-assembler-times "fmul" 2 } } */
10 /* { dg-final { scan-assembler-times "ftrc" 1 } } */
14 static const float pi
= 3.14159265359f
;
19 /* 1x shad, 1x lds, 1x fsca */
20 return sinf ( (x
>> 8) * (2*pi
) / (1 << 16));
27 return sinf (x
* (2*pi
) / 65536);
34 return sinf (x
* (2*pi
/ 65536));
41 float scale
= 2*pi
/ 65536;
42 return sinf (x
* scale
);
49 return cosf (x
/ 65536.0f
* 2*pi
);
55 /* 1x lds, 1x fsca, 1x fmul */
56 float scale
= 2*pi
/ 65536;
57 return sinf (x
* scale
) * cosf (x
* scale
);
63 /* 1x fmul, 1x ftrc, 1x fsca */