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.target/] [i386/] [fma4-256-vector.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* Test that the compiler properly optimizes floating point multiply and add
2
   instructions vector into vfmaddps on FMA4 systems.  */
3
 
4
/* { dg-do compile } */
5
/* { dg-require-effective-target lp64 } */
6
/* { dg-options "-O2 -mfma4 -ftree-vectorize" } */
7
 
8
extern void exit (int);
9
 
10
typedef float     __m256  __attribute__ ((__vector_size__ (32), __may_alias__));
11
typedef double    __m256d __attribute__ ((__vector_size__ (32), __may_alias__));
12
 
13
#define SIZE 10240
14
 
15
union {
16
  __m256 f_align;
17
  __m256d d_align;
18
  float f[SIZE];
19
  double d[SIZE];
20
} a, b, c, d;
21
 
22
void
23
flt_mul_add (void)
24
{
25
  int i;
26
 
27
  for (i = 0; i < SIZE; i++)
28
    a.f[i] = (b.f[i] * c.f[i]) + d.f[i];
29
}
30
 
31
void
32
dbl_mul_add (void)
33
{
34
  int i;
35
 
36
  for (i = 0; i < SIZE; i++)
37
    a.d[i] = (b.d[i] * c.d[i]) + d.d[i];
38
}
39
 
40
void
41
flt_mul_sub (void)
42
{
43
  int i;
44
 
45
  for (i = 0; i < SIZE; i++)
46
    a.f[i] = (b.f[i] * c.f[i]) - d.f[i];
47
}
48
 
49
void
50
dbl_mul_sub (void)
51
{
52
  int i;
53
 
54
  for (i = 0; i < SIZE; i++)
55
    a.d[i] = (b.d[i] * c.d[i]) - d.d[i];
56
}
57
 
58
void
59
flt_neg_mul_add (void)
60
{
61
  int i;
62
 
63
  for (i = 0; i < SIZE; i++)
64
    a.f[i] = (-(b.f[i] * c.f[i])) + d.f[i];
65
}
66
 
67
void
68
dbl_neg_mul_add (void)
69
{
70
  int i;
71
 
72
  for (i = 0; i < SIZE; i++)
73
    a.d[i] = (-(b.d[i] * c.d[i])) + d.d[i];
74
}
75
 
76
int main ()
77
{
78
  flt_mul_add ();
79
  flt_mul_sub ();
80
  flt_neg_mul_add ();
81
 
82
  dbl_mul_add ();
83
  dbl_mul_sub ();
84
  dbl_neg_mul_add ();
85
  exit (0);
86
}
87
 
88
/* { dg-final { scan-assembler "vfmaddps" } } */
89
/* { dg-final { scan-assembler "vfmaddpd" } } */
90
/* { dg-final { scan-assembler "vfmsubps" } } */
91
/* { dg-final { scan-assembler "vfmsubpd" } } */
92
/* { dg-final { scan-assembler "vfnmaddps" } } */
93
/* { dg-final { scan-assembler "vfnmaddpd" } } */

powered by: WebSVN 2.1.0

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