2 /* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */
3 /* { dg-require-effective-target sse2 } */
5 #include "sse2-check.h"
7 double x
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
8 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023, /* +-DBL_MAX */
9 -0x1p
-52, 0x1p
-52, /* +-DBL_EPSILON */
10 /* nextafter/before 0.5, 1.0 and 1.5 */
11 0x1.0000000000001p
-1, 0x1.fffffffffffffp
-2,
12 0x1.0000000000001p
+0, 0x1.fffffffffffffp
-1,
13 0x1.8000000000001p
+0, 0x1.7ffffffffffffp
+0,
14 -0.0, 0.0, -0.5, 0.5, -1.0, 1.0, -1.5, 1.5, -2.0, 2.0,
16 #define NUM (sizeof(x)/sizeof(double))
18 double expect_round
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
19 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
21 1.0, 0.0, 1.0, 1.0, 2.0, 1.0,
22 -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0,
25 double expect_rint
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
26 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
28 1.0, 0.0, 1.0, 1.0, 2.0, 1.0,
29 -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0,
32 double expect_floor
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
33 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
35 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
36 -0.0, 0.0, -1.0, 0.0, -1.0, 1.0, -2.0, 1.0, -2.0, 2.0,
39 double expect_ceil
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
40 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
42 1.0, 1.0, 2.0, 1.0, 2.0, 2.0,
43 -0.0, 0.0, -0.0, 1.0, -1.0, 1.0, -1.0, 2.0, -2.0, 2.0,
46 double expect_trunc
[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
47 -0x1.fffffffffffffp
+1023, 0x1.fffffffffffffp
+1023,
49 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
50 -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0,
55 void check_ ## fn (void) \
58 for (i = 0; i < NUM; ++i) \
60 double res = __builtin_ ## fn (x[i]); \
61 if (__builtin_memcmp (&res, &expect_ ## fn [i], sizeof(double)) != 0) \
62 printf( # fn " [%i]: %.18e %.18e\n", i, expect_ ## fn [i], res), abort (); \