2 /* { dg-options "-O2" } */
4 extern double copysign(double,double);
5 extern float copysignf(float,float);
6 extern double fabs(double);
7 extern float fabsf(float);
8 extern void abort(void);
11 double test1(double x
, double y
)
13 return copysign(-x
,y
);
16 float test1f(float x
, float y
)
18 return copysignf(-x
,y
);
21 double test2(double x
, double y
)
23 return copysign(fabs(x
),y
);
26 float test2f(float x
, float y
)
28 return copysignf(fabsf(x
),y
);
31 double test3(double x
, double y
, double z
)
33 return copysign(x
*-y
,z
);
36 float test3f(float x
, float y
, float z
)
38 return copysignf(x
*-y
,z
);
41 double test4(double x
, double y
, double z
)
43 return copysign(x
/-y
,z
);
46 float test4f(float x
, float y
, float z
)
48 return copysignf(x
/-y
,z
);
53 if (test1(3.0,2.0) != 3.0)
55 if (test1(3.0,-2.0) != -3.0)
57 if (test1(-3.0,2.0) != 3.0)
59 if (test1(-3.0,-2.0) != -3.0)
62 if (test1f(3.0f
,2.0f
) != 3.0f
)
64 if (test1f(3.0f
,-2.0f
) != -3.0f
)
66 if (test1f(-3.0f
,2.0f
) != 3.0f
)
68 if (test1f(-3.0f
,-2.0f
) != -3.0f
)
71 if (test2(3.0,2.0) != 3.0)
73 if (test2(3.0,-2.0) != -3.0)
75 if (test2(-3.0,2.0) != 3.0)
77 if (test2(-3.0,-2.0) != -3.0)
80 if (test2f(3.0f
,2.0f
) != 3.0f
)
82 if (test2f(3.0f
,-2.0f
) != -3.0f
)
84 if (test2f(-3.0f
,2.0f
) != 3.0f
)
86 if (test2f(-3.0f
,-2.0f
) != -3.0f
)
89 if (test3(2.0,3.0,4.0) != 6.0)
91 if (test3(2.0,3.0,-4.0) != -6.0)
93 if (test3(2.0,-3.0,4.0) != 6.0)
95 if (test3(2.0,-3.0,-4.0) != -6.0)
97 if (test3(-2.0,3.0,4.0) != 6.0)
99 if (test3(-2.0,3.0,-4.0) != -6.0)
101 if (test3(-2.0,-3.0,4.0) != 6.0)
103 if (test3(-2.0,-3.0,-4.0) != -6.0)
106 if (test3f(2.0f
,3.0f
,4.0f
) != 6.0f
)
108 if (test3f(2.0f
,3.0f
,-4.0f
) != -6.0f
)
110 if (test3f(2.0f
,-3.0f
,4.0f
) != 6.0f
)
112 if (test3f(2.0f
,-3.0f
,-4.0f
) != -6.0f
)
114 if (test3f(-2.0f
,3.0f
,4.0f
) != 6.0f
)
116 if (test3f(-2.0f
,3.0f
,-4.0f
) != -6.0f
)
118 if (test3f(-2.0f
,-3.0f
,4.0f
) != 6.0f
)
120 if (test3f(-2.0f
,-3.0f
,-4.0f
) != -6.0f
)
123 if (test4(8.0,2.0,3.0) != 4.0)
125 if (test4(8.0,2.0,-3.0) != -4.0)
127 if (test4(8.0,-2.0,3.0) != 4.0)
129 if (test4(8.0,-2.0,-3.0) != -4.0)
131 if (test4(-8.0,2.0,3.0) != 4.0)
133 if (test4(-8.0,2.0,-3.0) != -4.0)
135 if (test4(-8.0,-2.0,3.0) != 4.0)
137 if (test4(-8.0,-2.0,-3.0) != -4.0)
140 if (test4f(8.0f
,2.0f
,3.0f
) != 4.0f
)
142 if (test4f(8.0f
,2.0f
,-3.0f
) != -4.0f
)
144 if (test4f(8.0f
,-2.0f
,3.0f
) != 4.0f
)
146 if (test4f(8.0f
,-2.0f
,-3.0f
) != -4.0f
)
148 if (test4f(-8.0f
,2.0f
,3.0f
) != 4.0f
)
150 if (test4f(-8.0f
,2.0f
,-3.0f
) != -4.0f
)
152 if (test4f(-8.0f
,-2.0f
,3.0f
) != 4.0f
)
154 if (test4f(-8.0f
,-2.0f
,-3.0f
) != -4.0f
)