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

Subversion Repositories openrisc

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

Go to most recent revision | 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
extern double rint (double);
19
 
20
#define NUM 4
21
 
22
static void
23
__attribute__((__target__("fpmath=sse")))
24
init_src (double *src)
25
{
26
  int i, sign = 1;
27
  double f = rand ();
28
 
29
  for (i = 0; i < NUM; i++)
30
    {
31
      src[i] = (i + 1) * f * M_PI * sign;
32
      if (i < (NUM / 2))
33
        {
34
          if ((i % 6) == 0)
35
            f = f * src[i];
36
        }
37
      else if (i == (NUM / 2))
38
        f = rand ();
39
      else if ((i % 6) == 0)
40
        f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
41
      sign = -sign;
42
    }
43
}
44
 
45
static void
46
__attribute__((__target__("fpmath=387")))
47
TEST (void)
48
{
49
  double a[NUM];
50
  int r[NUM];
51
  int i;
52
 
53
  init_src (a);
54
 
55
  for (i = 0; i < NUM; i++)
56
    r[i] = (int) rint (a[i]);
57
 
58
  /* check results:  */
59
  for (i = 0; i < NUM; i++)
60
    if (r[i] != (int) rint (a[i]))
61
      abort();
62
}

powered by: WebSVN 2.1.0

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