Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / sse-recip.c
blob4f7d3bf3d549d73d0ec8eb0aa3b78bc6336bc0de
1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */
3 /* { dg-require-effective-target sse } */
5 #include "sse-check.h"
7 extern float sqrtf (float);
8 extern float fabsf (float);
10 #define N 8
12 static void
13 sse_test (void)
15 float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f };
16 float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
17 float r[N];
19 float rc[N] = { 0.f, 3.f, 6.f, 9.f, 12.f, 18.f, 21.f, 27.f };
21 int i;
23 for (i = 0; i < N; i++)
25 r[i] = sqrtf (a[i] / b[i]);
28 /* check results: */
29 for (i = 0; i < N; i++)
31 if (fabsf (r[i] - rc[i]) > 0.0001)
32 abort();