2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr36578-2.c
blobbfde2cb0ffa6de295536a8f85af17bc50f86e1b0
1 /* Test for unsafe floating-point conversions. */
2 /* { dg-do run } */
3 /* { dg-options "-msse2 -mfpmath=sse" } */
4 /* { dg-require-effective-target sse2 } */
6 #include "sse2-check.h"
8 extern void abort (void);
9 extern void exit (int);
10 extern int printf(const char *, ...);
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;
18 static void
19 sse2_test (void)
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);
26 if (f != f2)
27 abort ();
28 exit (0);