| 1 |
/* Test for unsafe floating-point conversions. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-msse2 -mfpmath=sse" } */ |
| 4 |
/* { dg-require-effective-target sse2 } */ |
| 5 |
|
| 6 |
#include "sse2-check.h" |
| 7 |
|
| 8 |
extern void abort (void); |
| 9 |
extern void exit (int); |
| 10 |
extern int printf(const char *, ...); |
| 11 |
|
| 12 |
volatile double d1 = 0x1.000001p0; |
| 13 |
volatile double d2 = 0x1p-54; |
| 14 |
volatile double d2d = 0x1p-52; |
| 15 |
volatile float f = 0x1.000002p0f; |
| 16 |
volatile float f2; |
| 17 |
|
| 18 |
static void |
| 19 |
sse2_test (void) |
| 20 |
{ |
| 21 |
if (sizeof(long double) > sizeof(double) ) { |
| 22 |
f2 = (float)((long double)d1 + (long double)d2); |
| 23 |
} else { |
| 24 |
f2 = (float)((long double)d1 + (long double)d2d); |
| 25 |
} |
| 26 |
if (f != f2) |
| 27 |
abort (); |
| 28 |
exit (0); |
| 29 |
} |