copysign1.c: Special case sizeof long double for intel double extended format.

* gcc.c-torture/execute/ieee/copysign1.c: Special case sizeof
        long double for intel double extended format.
        * gcc.c-torture/execute/ieee/copysign2.c: Likewise.

From-SVN: r94472
This commit is contained in:
Richard Henderson 2005-01-31 01:10:01 -08:00 committed by Richard Henderson
parent ae3946599e
commit 93b39cbcc9
3 changed files with 46 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2005-01-31 Richard Henderson <rth@redhat.com>
* gcc.c-torture/execute/ieee/copysign1.c: Special case sizeof
long double for intel double extended format.
* gcc.c-torture/execute/ieee/copysign2.c: Likewise.
2005-01-30 Mark Mitchell <mark@codesourcery.com>
PR c++/19555

View File

@ -1,5 +1,22 @@
#include <string.h>
#include <stdlib.h>
#include <float.h>
#define fpsizeoff sizeof(float)
#define fpsizeof sizeof(double)
#define fpsizeofl sizeof(long double)
/* Work around the fact that with the Intel double-extended precision,
we've got a 10 byte type stuffed into some amount of padding. And
the fact that -ffloat-store is going to stuff this value temporarily
into some bit of stack frame that we've no control over and can't zero. */
#if LDBL_MANT_DIG == 64
# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__)
# undef fpsizeofl
# define fpsizeofl 10
# endif
#endif
#define TEST(TYPE, EXT) \
TYPE c##EXT (TYPE x, TYPE y) \
@ -25,12 +42,10 @@ void test##EXT (void) \
{ \
int i, n = sizeof (T##EXT) / sizeof (T##EXT[0]); \
TYPE r; \
/* Make sure to avoid comparing unused bits in the type. */ \
memset (&r, 0, sizeof r); \
for (i = 0; i < n; ++i) \
{ \
r = c##EXT (T##EXT[i].x, T##EXT[i].y); \
if (memcmp (&r, &T##EXT[i].z, sizeof r) != 0) \
if (memcmp (&r, &T##EXT[i].z, fpsizeof##EXT) != 0) \
abort (); \
} \
}

View File

@ -1,5 +1,23 @@
#include <string.h>
#include <stdlib.h>
#include <float.h>
#define fpsizeoff sizeof(float)
#define fpsizeof sizeof(double)
#define fpsizeofl sizeof(long double)
/* Work around the fact that with the Intel double-extended precision,
we've got a 10 byte type stuffed into some amount of padding. And
the fact that -ffloat-store is going to stuff this value temporarily
into some bit of stack frame that we've no control over and can't zero. */
#if LDBL_MANT_DIG == 64
# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__)
# undef fpsizeofl
# define fpsizeofl 10
# endif
#endif
#define TEST(TYPE, EXT) \
static TYPE Y##EXT[] = { \
@ -13,8 +31,7 @@ static const TYPE Z##EXT[] = { \
void test##EXT (void) \
{ \
TYPE r[8]; \
/* Make sure to avoid comparing unused bits in the type. */ \
memset (r, 0, sizeof r); \
int i; \
r[0] = __builtin_copysign##EXT (1.0, Y##EXT[0]); \
r[1] = __builtin_copysign##EXT (1.0, Y##EXT[1]); \
r[2] = __builtin_copysign##EXT (-1.0, Y##EXT[2]); \
@ -23,8 +40,9 @@ void test##EXT (void) \
r[5] = __builtin_copysign##EXT (-0.0, Y##EXT[5]); \
r[6] = __builtin_copysign##EXT (__builtin_inf##EXT (), Y##EXT[6]); \
r[7] = __builtin_copysign##EXT (-__builtin_nan##EXT (""), Y##EXT[7]); \
if (memcmp (r, Z##EXT, sizeof r) != 0) \
abort (); \
for (i = 0; i < 8; ++i) \
if (memcmp (r+i, Z##EXT+i, fpsizeof##EXT) != 0) \
abort (); \
}
TEST(float, f)