From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.target/i386/fpprec-1.c | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/fpprec-1.c (limited to 'gcc/testsuite/gcc.target/i386/fpprec-1.c') diff --git a/gcc/testsuite/gcc.target/i386/fpprec-1.c b/gcc/testsuite/gcc.target/i386/fpprec-1.c new file mode 100644 index 000000000..1c17c1d10 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/fpprec-1.c @@ -0,0 +1,80 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */ +/* { dg-require-effective-target sse2 } */ + +#include "sse2-check.h" + +double x[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, /* +-DBL_MAX */ + -0x1p-52, 0x1p-52, /* +-DBL_EPSILON */ + /* nextafter/before 0.5, 1.0 and 1.5 */ + 0x1.0000000000001p-1, 0x1.fffffffffffffp-2, + 0x1.0000000000001p+0, 0x1.fffffffffffffp-1, + 0x1.8000000000001p+0, 0x1.7ffffffffffffp+0, + -0.0, 0.0, -0.5, 0.5, -1.0, 1.0, -1.5, 1.5, -2.0, 2.0, + -2.5, 2.5 }; +#define NUM (sizeof(x)/sizeof(double)) + +double expect_round[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, + -0.0, 0.0, + 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, + -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0, + -3.0, 3.0 }; + +double expect_rint[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, + -0.0, 0.0, + 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, + -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -2.0, 2.0, -2.0, 2.0, + -2.0, 2.0 }; + +double expect_floor[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, + -1.0, 0.0, + 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, + -0.0, 0.0, -1.0, 0.0, -1.0, 1.0, -2.0, 1.0, -2.0, 2.0, + -3.0, 2.0 }; + +double expect_ceil[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, + -0.0, 1.0, + 1.0, 1.0, 2.0, 1.0, 2.0, 2.0, + -0.0, 0.0, -0.0, 1.0, -1.0, 1.0, -1.0, 2.0, -2.0, 2.0, + -2.0, 3.0 }; + +double expect_trunc[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), + -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, + -0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, + -0.0, 0.0, -0.0, 0.0, -1.0, 1.0, -1.0, 1.0, -2.0, 2.0, + -2.0, 2.0 }; + + +#define CHECK(fn) \ +void check_ ## fn (void) \ +{ \ + int i; \ + for (i = 0; i < NUM; ++i) \ + { \ + double res = __builtin_ ## fn (x[i]); \ + if (__builtin_memcmp (&res, &expect_ ## fn [i], sizeof(double)) != 0) \ + printf( # fn " [%i]: %.18e %.18e\n", i, expect_ ## fn [i], res), abort (); \ + } \ +} + +CHECK(round) +CHECK(rint) +CHECK(floor) +CHECK(ceil) +CHECK(trunc) + +static void +sse2_test (void) +{ + check_round (); + check_rint (); + check_floor (); + check_ceil (); + check_trunc (); +} -- cgit v1.2.3