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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [fma-fmaddXX.c] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target fma } */
3
/* { dg-options "-O2 -mfma" } */
4
 
5
#include "fma-check.h"
6
 
7
#include <x86intrin.h>
8
#include "m256-check.h"
9
 
10
void
11
check_mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
12
{
13
  union128d a, b, c, e;
14
  a.x = __A;
15
  b.x = __B;
16
  c.x = __C;
17
  double d[2];
18
  int i;
19
  e.x = _mm_fmadd_pd (__A, __B, __C);
20
  for (i = 0; i < 2; i++)
21
    {
22
      d[i] = a.a[i] * b.a[i] + c.a[i];
23
    }
24
 
25
  if (check_union128d (e, d))
26
    abort ();
27
}
28
 
29
void
30
check_mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)
31
{
32
  union128 a, b, c, e;
33
  a.x = __A;
34
  b.x = __B;
35
  c.x = __C;
36
  float d[4];
37
  int i;
38
  e.x = _mm_fmadd_ps (__A, __B, __C);
39
  for (i = 0; i < 4; i++)
40
    {
41
      d[i] = a.a[i] * b.a[i] + c.a[i];
42
    }
43
  if (check_union128 (e, d))
44
    abort ();
45
}
46
 
47
void
48
check_mm_fmadd_sd (__m128d __A, __m128d __B, __m128d __C)
49
{
50
  union128d a, b, c, e;
51
  a.x = __A;
52
  b.x = __B;
53
  c.x = __C;
54
  double d[2];
55
  int i;
56
  e.x = _mm_fmadd_sd (__A, __B, __C);
57
  for (i = 1; i < 2; i++)
58
    {
59
      d[i] = a.a[i];
60
    }
61
  d[0] = a.a[0] * b.a[0] + c.a[0];
62
  if (check_union128d (e, d))
63
    abort ();
64
}
65
 
66
void
67
check_mm_fmadd_ss (__m128 __A, __m128 __B, __m128 __C)
68
{
69
  union128 a, b, c, e;
70
  a.x = __A;
71
  b.x = __B;
72
  c.x = __C;
73
  float d[4];
74
  int i;
75
  e.x = _mm_fmadd_ss (__A, __B, __C);
76
  for (i = 1; i < 4; i++)
77
    {
78
      d[i] = a.a[i];
79
    }
80
  d[0] = a.a[0] * b.a[0] + c.a[0];
81
  if (check_union128 (e, d))
82
    abort ();
83
}
84
 
85
static void
86
fma_test (void)
87
{
88
  union128 a[3];
89
  union128d b[3];
90
  int i, j;
91
  for (i = 0; i < 3; i++)
92
    {
93
      for (j = 0; j < 4; j++)
94
        a[i].a[j] = i * j + 3.5;
95
      for (j = 0; j < 2; j++)
96
        b[i].a[j] = i * j + 3.5;
97
    }
98
  check_mm_fmadd_pd (b[0].x, b[1].x, b[2].x);
99
  check_mm_fmadd_sd (b[0].x, b[1].x, b[2].x);
100
  check_mm_fmadd_ps (a[0].x, a[1].x, a[2].x);
101
  check_mm_fmadd_ss (a[0].x, a[1].x, a[2].x);
102
}

powered by: WebSVN 2.1.0

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