2 /* This test is too big for small targets. */
3 /* { dg-require-effective-target size32plus } */
15 unsigned long long ul
[N
];
19 #define FN1(from, to) \
20 __attribute__((noinline, noclone)) void \
24 for (i = 0; i < N; i++) \
27 #define FN(intt, fltt) FN1 (intt, fltt) FN1 (fltt, intt)
46 #define FLTTEST(min, max, intt) \
47 __attribute__((noinline, noclone)) void \
48 flttointtest##intt (void) \
51 volatile float fltmin, fltmax, vf, vf2; \
52 volatile double dblmin, dblmax, vd, vd2; \
57 vf2 = fltmin = min - 1.0f; \
58 for (vf = 1.0f; (fltmin = vf2 + vf) == vf2; vf = vf * 2.0f) \
61 vf2 = fltmax = max + 1.0f; \
62 for (vf = 1.0f; (fltmax = vf2 - vf) == vf2; vf = vf * 2.0f) \
68 vd2 = dblmin = min - 1.0; \
69 for (vd = 1.0; (dblmin = vd2 + vd) == vd2; vd = vd * 2.0) \
72 vd2 = dblmax = max + 1.0; \
73 for (vd = 1.0; (dblmax = vd2 - vd) == vd2; vd = vd * 2.0) \
75 for (i = 0; i < N; i++) \
81 f[i] = fltmin + i + 0.25f; \
82 else if (i < 3 * N / 4) \
83 f[i] = (fltmax + fltmin) / 2.0 - N * 8 + 16.0f * i; \
85 f[i] = fltmax - N + 1 + i; \
86 if (f[i] < fltmin) f[i] = fltmin; \
87 if (f[i] > fltmax) f[i] = fltmax; \
91 d[i] = dblmin + i + 0.25f; \
92 else if (i < 3 * N / 4) \
93 d[i] = (dblmax + dblmin) / 2.0 - N * 8 + 16.0f * i; \
95 d[i] = dblmax - N + 1 + i; \
96 if (d[i] < dblmin) d[i] = dblmin; \
97 if (d[i] > dblmax) d[i] = dblmax; \
100 for (i = 0; i < N; i++) \
101 if (intt[i] != (__typeof (intt[0])) f[i]) \
104 for (i = 0; i < N; i++) \
105 if (intt[i] != (__typeof (intt[0])) d[i]) \
107 for (i = 0; i < N; i++) \
109 unsigned long long r = rand (); \
110 r = (r << 21) ^ (unsigned) rand (); \
111 r = (r << 21) ^ (unsigned) rand (); \
113 f[i] = (r >> 59) / 32.0f + (__typeof (intt[0])) r; \
114 if (f[i] < fltmin) f[i] = fltmin; \
115 if (f[i] > fltmax) f[i] = fltmax; \
116 d[i] = (r >> 59) / 32.0 + (__typeof (intt[0])) r; \
117 if (d[i] < dblmin) f[i] = dblmin; \
118 if (d[i] > dblmax) f[i] = dblmax; \
121 for (i = 0; i < N; i++) \
122 if (intt[i] != (__typeof (intt[0])) f[i]) \
125 for (i = 0; i < N; i++) \
126 if (intt[i] != (__typeof (intt[0])) d[i]) \
130 __attribute__((noinline, noclone)) void \
131 inttoflttest##intt (void) \
135 volatile double vd; \
136 for (i = 0; i < N; i++) \
141 else if (i < 3 * N / 4) \
142 intt[i] = (max + min) / 2 - N * 8 + 16 * i; \
144 intt[i] = max - N + 1 + i; \
147 for (i = 0; i < N; i++) \
154 for (i = 0; i < N; i++) \
160 for (i = 0; i < N; i++) \
162 unsigned long long r = rand (); \
163 r = (r << 21) ^ (unsigned) rand (); \
164 r = (r << 21) ^ (unsigned) rand (); \
169 for (i = 0; i < N; i++) \
176 for (i = 0; i < N; i++) \
184 FLTTEST (- __SCHAR_MAX__
- 1, __SCHAR_MAX__
, sc
)
185 FLTTEST (- __SHRT_MAX__
- 1, __SHRT_MAX__
, ss
)
186 FLTTEST (- __INT_MAX__
- 1, __INT_MAX__
, si
)
187 FLTTEST (- __LONG_LONG_MAX__
- 1LL, __LONG_LONG_MAX__
, sl
)
188 FLTTEST (0, 2U * __SCHAR_MAX__
+ 1, uc
)
189 FLTTEST (0, 2U * __SHRT_MAX__
+ 1, us
)
190 FLTTEST (0, 2U * __INT_MAX__
+ 1, ui
)
191 FLTTEST (0, 2ULL * __LONG_LONG_MAX__
+ 1, ul
)