2 /* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */
4 #include "sse2-check.h"
6 double x
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
7 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023, /* +-DBL_MAX */
8 -0x1p
-52, 0x1p
-52, /* +-DBL_EPSILON */
9 /* nextafter/before 0.5, 1.0 and 1.5 */
10 0x1.0000000000001p
-1, 0x1.fffffffffffffp
-2,
11 0x1.0000000000001p
+0, 0x1.fffffffffffffp
-1,
12 0x1.8000000000001p
+0, 0x1.7ffffffffffffp
+0,
13 -0.0, 0.0, -0.5, 0.5, -1.0, 1.0, -1.5, 1.5, -2.0, 2.0,
15 #define NUM (sizeof(x)/sizeof(double))
17 double expect_round
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
18 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
20 1.0, 0.0, 1.0, 1.0, 2.0, 1.0,
21 -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0,
24 double expect_rint
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
25 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
27 1.0, 0.0, 1.0, 1.0, 2.0, 1.0,
28 -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0,
31 double expect_floor
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
32 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
34 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
35 -0.0, 0.0, -1.0, 0.0, -1.0, 1.0, -2.0, 1.0, -2.0, 2.0,
38 double expect_ceil
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
39 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
41 1.0, 1.0, 2.0, 1.0, 2.0, 2.0,
42 -0.0, 0.0, -0.0, 1.0, -1.0, 1.0, -1.0, 2.0, -2.0, 2.0,
45 double expect_trunc
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
46 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
48 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
49 -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0,
54 void check_ ## fn (void) \
57 for (i = 0; i < NUM; ++i) \
59 double res = __builtin_ ## fn (x[i]); \
60 if (__builtin_memcmp (&res, &expect_ ## fn [i], sizeof(double)) != 0) \
61 printf( # fn " [%i]: %.18e %.18e\n", i, expect_ ## fn [i], res), abort (); \