1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 
4 extern double fma (double, double, double);
5 extern float fmaf (float, float, float);
6 
test_fma1(double x,double y,double z)7 double test_fma1 (double x, double y, double z)
8 {
9   return fma (x, y, z);
10 }
11 
test_fma2(float x,float y,float z)12 float test_fma2 (float x, float y, float z)
13 {
14   return fmaf (x, y, z);
15 }
16 
test_fnma1(double x,double y,double z)17 double test_fnma1 (double x, double y, double z)
18 {
19   return fma (-x, y, z);
20 }
21 
test_fnma2(float x,float y,float z)22 float test_fnma2 (float x, float y, float z)
23 {
24   return fmaf (-x, y, z);
25 }
26 
test_fms1(double x,double y,double z)27 double test_fms1 (double x, double y, double z)
28 {
29   return fma (x, y, -z);
30 }
31 
test_fms2(float x,float y,float z)32 float test_fms2 (float x, float y, float z)
33 {
34   return fmaf (x, y, -z);
35 }
36 
test_fnms1(double x,double y,double z)37 double test_fnms1 (double x, double y, double z)
38 {
39   return fma (-x, y, -z);
40 }
41 
test_fnms2(float x,float y,float z)42 float test_fnms2 (float x, float y, float z)
43 {
44   return fmaf (-x, y, -z);
45 }
46 
47 /* { dg-final { scan-assembler-times "fmadd\td\[0-9\]" 1 } } */
48 /* { dg-final { scan-assembler-times "fmadd\ts\[0-9\]" 1 } } */
49 /* { dg-final { scan-assembler-times "fmsub\td\[0-9\]" 1 } } */
50 /* { dg-final { scan-assembler-times "fmsub\ts\[0-9\]" 1 } } */
51 /* { dg-final { scan-assembler-times "fnmsub\td\[0-9\]" 1 } } */
52 /* { dg-final { scan-assembler-times "fnmsub\ts\[0-9\]" 1 } } */
53 /* { dg-final { scan-assembler-times "fnmadd\td\[0-9\]" 1 } } */
54 /* { dg-final { scan-assembler-times "fnmadd\ts\[0-9\]" 1 } } */
55 
56