In gcc/testsuite/: 2011-03-04 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr41963.c
blob408a3d24c00934c655b8f812db46e802dbc587d7
1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math" } */
4 extern float fabsf(float);
5 extern float sqrtf(float);
7 static __attribute__((noinline)) void f (float *dst, float *src)
9 int i, j;
10 for (i = 0; i < 2; i++)
12 float len;
13 dst[0] = src[0];
14 dst[1] = src[1];
15 len = sqrtf (dst[0] * dst[0] + dst[1] * dst[1]);
16 if (len > 0.5f)
18 len = 1.0f / len;
19 dst[0] *= len;
20 dst[1] *= len;
25 extern void abort (void);
27 int main()
29 float dst[2], src[2];
30 src[0] = 2.0f;
31 src[1] = 5.0f;
32 f (dst, src);
33 if (fabsf (dst[0] * dst[0] + dst[1] * dst[1] - 1.0f) > 0.01f)
34 abort ();
35 return 0;