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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [avx-cvt-2-vec.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx" } */
3
/* { dg-require-effective-target avx } */
4
/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
5
 
6
#ifndef CHECK_H
7
#define CHECK_H "avx-check.h"
8
#endif
9
 
10
#ifndef TEST
11
#define TEST avx_test
12
#endif
13
 
14
#include CHECK_H
15
 
16
#include <math.h>
17
 
18
#define NUM 4
19
 
20
static void
21
__attribute__((__target__("fpmath=sse")))
22
init_src (double *src)
23
{
24
  int i, sign = 1;
25
  double f = rand ();
26
 
27
  for (i = 0; i < NUM; i++)
28
    {
29
      src[i] = (i + 1) * f * M_PI * sign;
30
      if (i < (NUM / 2))
31
        {
32
          if ((i % 6) == 0)
33
            f = f * src[i];
34
        }
35
      else if (i == (NUM / 2))
36
        f = rand ();
37
      else if ((i % 6) == 0)
38
        f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
39
      sign = -sign;
40
    }
41
}
42
 
43
static void
44
__attribute__((__target__("fpmath=sse")))
45
TEST (void)
46
{
47
  double a[NUM];
48
  float r[NUM];
49
  int i;
50
 
51
  init_src (a);
52
 
53
  for (i = 0; i < NUM; i++)
54
    r[i] = (float) a[i];
55
 
56
  /* check results:  */
57
  for (i = 0; i < NUM; i++)
58
    if (r[i] != (float) a[i])
59
      abort();
60
}

powered by: WebSVN 2.1.0

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