1 /* PR84407 */
2 /* { dg-do run { xfail { arm-*-* } } } */
3 /* { dg-require-effective-target fenv } */
4 /* { dg-require-effective-target hard_float } */
5 /* { dg-additional-options "-frounding-math" } */
6
7 #include <fenv.h>
8 #include <stdlib.h>
9
10 void __attribute__((noipa))
11 fooa ()
12 {
13 #if __DBL_MANT_DIG__ == 53
14 #ifdef FE_TONEAREST
15 fesetround(FE_TONEAREST);
16 /* Large enough constant to trigger unsigned_float. */
17 __UINT64_TYPE__ x = 0x8000000000000001;
18 double f = x;
19 if (f != 0x1p+63)
20 abort ();
21 #endif
22 #endif
23 }
24
25 void __attribute__((noipa))
26 foob ()
27 {
28 #if __DBL_MANT_DIG__ == 53
29 #ifdef FE_DOWNWARD
30 fesetround(FE_DOWNWARD);
31 __UINT64_TYPE__ x = 0x8000000000000001;
32 double f = x;
33 if (f != 0x1p+63)
34 abort ();
35 #endif
36 #endif
37 }
38
39 void __attribute__((noipa))
40 fooc ()
41 {
42 #if __DBL_MANT_DIG__ == 53
43 #ifdef FE_UPWARD
44 fesetround(FE_UPWARD);
45 __UINT64_TYPE__ x = 0x8000000000000001;
46 double f = x;
47 if (f != 0x1.0000000000001p+63)
48 abort ();
49 #endif
50 #endif
51 }
52
53 void __attribute__((noipa))
54 food ()
55 {
56 #if __DBL_MANT_DIG__ == 53
57 #ifdef FE_TOWARDZERO
58 fesetround(FE_TOWARDZERO);
59 __UINT64_TYPE__ x = 0x8000000000000001;
60 double f = x;
61 if (f != 0x1p+63)
62 abort ();
63 #endif
64 #endif
65 }
66
67
68 int
69 main ()
70 {
71 fooa ();
72 foob ();
73 fooc ();
74 food ();
75 return 0;
76 }