1 /* { dg-options "-O1" } */
2 
3 /* Check that the compiler uses builtins for signbit; if not the link
4    will fail because library functions are in libm.  */
5 /* See PR51867.
6    Since GCC uses library call when optimizing for "-O0", this test
7    case requires at least "-O1" level optimization now.  */
8 
9 #include "dfp-dbg.h"
10 
11 volatile _Decimal32 sd = 2.3df;
12 volatile _Decimal64 dd = -4.5dd;
13 volatile _Decimal128 tf = 5.3dl;
14 volatile float f = 1.2f;
15 volatile double d = -7.8;
16 volatile long double ld = 3.4L;
17 
18 EXTERN int signbitf (float);
19 EXTERN int signbit (double);
20 EXTERN int signbitl (long double);
21 EXTERN int signbitd32 (_Decimal32);
22 EXTERN int signbitd64 (_Decimal64);
23 EXTERN int signbitd128 (_Decimal128);
24 
25 int
main()26 main ()
27 {
28   if (signbitf (f) != 0) FAILURE
29   if (signbit (d) == 0) FAILURE
30   if (signbitl (ld) != 0) FAILURE
31   if (signbitd32 (sd) != 0) FAILURE
32   if (signbitd64 (dd) == 0) FAILURE
33   if (signbitd128 (tf) != 0) FAILURE
34 
35   FINISH
36 }
37