LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-tgmath-3.c
blob35364ea3ee3cf1d0928ec72e1aa511e12c591a1e
1 /* Test __builtin_tgmath: integer arguments mapped to _Float64. */
2 /* { dg-do run } */
3 /* { dg-options "" } */
4 /* { dg-add-options float32 } */
5 /* { dg-add-options float64 } */
6 /* { dg-require-effective-target float32_runtime } */
7 /* { dg-require-effective-target float64_runtime } */
9 extern void abort (void);
10 extern void exit (int);
12 #define CHECK_CALL(C, E, V) \
13 do \
14 { \
15 if ((C) != (E)) \
16 abort (); \
17 extern __typeof (C) V; \
18 } \
19 while (0)
21 extern _Float32 var_f32;
23 _Float32 t1f (float x) { return x + 1; }
24 _Float32 t1d (double x) { return x + 2; }
25 _Float32 t1l (long double x) { return x + 3; }
26 _Float32 t1f64 (_Float64 x) { return x + 4; }
28 #define t1v(x) __builtin_tgmath (t1f, t1d, t1l, t1f64, x)
30 static void
31 test_1 (void)
33 float f = 1;
34 double d = 2;
35 long double ld = 3;
36 _Float64 f64 = 4;
37 int i = 5;
38 CHECK_CALL (t1v (f), 2, var_f32);
39 CHECK_CALL (t1v (d), 4, var_f32);
40 CHECK_CALL (t1v (ld), 6, var_f32);
41 CHECK_CALL (t1v (f64), 8, var_f32);
42 CHECK_CALL (t1v (i), 9, var_f32);
45 int
46 main (void)
48 test_1 ();
49 exit (0);