OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr41963.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -ffast-math" } */
3
 
4
extern float fabsf(float);
5
extern float sqrtf(float);
6
 
7
static __attribute__((noinline)) void f (float *dst, float *src)
8
{
9
  int i, j;
10
  for (i = 0; i < 2; i++)
11
    {
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)
17
        {
18
          len = 1.0f / len;
19
          dst[0] *= len;
20
          dst[1] *= len;
21
        }
22
    }
23
}
24
 
25
extern void abort (void);
26
 
27
int main()
28
{
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;
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.