]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/torture/floatn-builtin.h
c562812d1d014fe698949e80f2cae91fb1f2839a
1 /* Tests for _FloatN / _FloatNx types: compile and execution tests for
2 built-in functions. Before including this file, define WIDTH as
3 the value N; define EXT to 1 for _FloatNx and 0 for _FloatN. */
5 #define CONCATX(X, Y) X ## Y
6 #define CONCAT(X, Y) CONCATX (X, Y)
7 #define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z)
8 #define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z)
11 # define TYPE CONCAT3 (_Float, WIDTH, x)
12 # define CST(C) CONCAT4 (C, f, WIDTH, x)
13 # define FN(F) CONCAT4 (F, f, WIDTH, x)
15 # define TYPE CONCAT (_Float, WIDTH)
16 # define CST(C) CONCAT3 (C, f, WIDTH)
17 # define FN(F) CONCAT3 (F, f, WIDTH)
20 extern void exit (int);
21 extern void abort (void);
23 extern TYPE test_type
;
24 extern __typeof (FN (__builtin_inf
) ()) test_type
;
25 extern __typeof (FN (__builtin_huge_val
) ()) test_type
;
26 extern __typeof (FN (__builtin_nan
) ("")) test_type
;
27 extern __typeof (FN (__builtin_nans
) ("")) test_type
;
28 extern __typeof (FN (__builtin_fabs
) (0)) test_type
;
29 extern __typeof (FN (__builtin_copysign
) (0, 0)) test_type
;
31 volatile TYPE inf_cst
= FN (__builtin_inf
) ();
32 volatile TYPE huge_val_cst
= FN (__builtin_huge_val
) ();
33 volatile TYPE nan_cst
= FN (__builtin_nan
) ("");
34 volatile TYPE nans_cst
= FN (__builtin_nans
) ("");
35 volatile TYPE neg0
= -CST (0.0), neg1
= -CST (1.0), one
= 1.0;
41 if (!__builtin_isinf (inf_cst
))
43 if (!__builtin_isinf (huge_val_cst
))
45 if (inf_cst
!= huge_val_cst
)
47 if (!__builtin_isnan (nan_cst
))
49 if (!__builtin_isnan (nans_cst
))
51 r
= FN (__builtin_fabs
) (neg1
);
54 r
= FN (__builtin_copysign
) (one
, neg0
);
57 r
= FN (__builtin_copysign
) (inf_cst
, neg1
);
58 if (r
!= -huge_val_cst
)
60 r
= FN (__builtin_copysign
) (-inf_cst
, one
);
61 if (r
!= huge_val_cst
)