Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / brokensqrt.c
blob836d3b37d4cac2505250b1b3405fa15e9264633c
1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */
3 /* { dg-require-effective-target sse } */
4 #include "sse-check.h"
6 extern float sqrtf (float);
7 float __attribute__((noinline)) broken (float a, float b)
9 return sqrtf (a / b);
12 extern void abort (void);
13 extern void *memcpy (void *, const void *, __SIZE_TYPE__);
14 static void
15 sse_test (void)
17 int i;
18 float x;
19 char buf[sizeof (float)];
20 x = broken (0.0f, 10000.0f);
21 /* A convoluted way to check for the correct result (zero) for all
22 floating point formats.
23 We can't use ==, !=, or range checks, or isinf/isnan/isunordered,
24 because all of these will not do the right thing under -ffast-math,
25 as they can assume that neither nan nor inf are returned. */
26 memcpy (&buf, &x, sizeof (float));
27 for (i = 0; i < sizeof (float); i++)
28 if (buf[i] != 0)
29 abort ();