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"
5 
6 extern float sqrtf (float);
broken(float a,float b)7 float __attribute__((noinline)) broken (float a, float b)
8 {
9   return sqrtf (a / b);
10 }
11 
12 extern void abort (void);
13 extern void *memcpy (void *, const void *, __SIZE_TYPE__);
14 static void
sse_test(void)15 sse_test (void)
16 {
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 ();
30 }
31