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/] [funcspec-2.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* Test whether using target specific options, we can generate FMA4 code.  */
2
/* { dg-do compile } */
3
/* { dg-require-effective-target lp64 } */
4
/* { dg-options "-O2 -march=k8" } */
5
 
6
extern void exit (int);
7
 
8
#define FMA4_ATTR __attribute__((__target__("fma4")))
9
extern float  flt_mul_add     (float a, float b, float c) FMA4_ATTR;
10
extern float  flt_mul_sub     (float a, float b, float c) FMA4_ATTR;
11
extern float  flt_neg_mul_add (float a, float b, float c) FMA4_ATTR;
12
extern float  flt_neg_mul_sub (float a, float b, float c) FMA4_ATTR;
13
 
14
extern double dbl_mul_add     (double a, double b, double c) FMA4_ATTR;
15
extern double dbl_mul_sub     (double a, double b, double c) FMA4_ATTR;
16
extern double dbl_neg_mul_add (double a, double b, double c) FMA4_ATTR;
17
extern double dbl_neg_mul_sub (double a, double b, double c) FMA4_ATTR;
18
 
19
float
20
flt_mul_add (float a, float b, float c)
21
{
22
  return (a * b) + c;
23
}
24
 
25
double
26
dbl_mul_add (double a, double b, double c)
27
{
28
  return (a * b) + c;
29
}
30
 
31
float
32
flt_mul_sub (float a, float b, float c)
33
{
34
  return (a * b) - c;
35
}
36
 
37
double
38
dbl_mul_sub (double a, double b, double c)
39
{
40
  return (a * b) - c;
41
}
42
 
43
float
44
flt_neg_mul_add (float a, float b, float c)
45
{
46
  return (-(a * b)) + c;
47
}
48
 
49
double
50
dbl_neg_mul_add (double a, double b, double c)
51
{
52
  return (-(a * b)) + c;
53
}
54
 
55
float
56
flt_neg_mul_sub (float a, float b, float c)
57
{
58
  return (-(a * b)) - c;
59
}
60
 
61
double
62
dbl_neg_mul_sub (double a, double b, double c)
63
{
64
  return (-(a * b)) - c;
65
}
66
 
67
float  f[10] = { 2, 3, 4 };
68
double d[10] = { 2, 3, 4 };
69
 
70
int main ()
71
{
72
  f[3] = flt_mul_add (f[0], f[1], f[2]);
73
  f[4] = flt_mul_sub (f[0], f[1], f[2]);
74
  f[5] = flt_neg_mul_add (f[0], f[1], f[2]);
75
  f[6] = flt_neg_mul_sub (f[0], f[1], f[2]);
76
 
77
  d[3] = dbl_mul_add (d[0], d[1], d[2]);
78
  d[4] = dbl_mul_sub (d[0], d[1], d[2]);
79
  d[5] = dbl_neg_mul_add (d[0], d[1], d[2]);
80
  d[6] = dbl_neg_mul_sub (d[0], d[1], d[2]);
81
  exit (0);
82
}
83
 
84
/* { dg-final { scan-assembler "vfmaddss" } } */
85
/* { dg-final { scan-assembler "vfmaddsd" } } */
86
/* { dg-final { scan-assembler "vfmsubss" } } */
87
/* { dg-final { scan-assembler "vfmsubsd" } } */
88
/* { dg-final { scan-assembler "vfnmaddss" } } */
89
/* { dg-final { scan-assembler "vfnmaddsd" } } */
90
/* { dg-final { scan-assembler "vfnmsubss" } } */
91
/* { dg-final { scan-assembler "vfnmsubsd" } } */
92
/* { dg-final { scan-assembler "call\t(.*)flt_mul_add" } } */
93
/* { dg-final { scan-assembler "call\t(.*)flt_mul_sub" } } */
94
/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_add" } } */
95
/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_sub" } } */
96
/* { dg-final { scan-assembler "call\t(.*)dbl_mul_add" } } */
97
/* { dg-final { scan-assembler "call\t(.*)dbl_mul_sub" } } */
98
/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_add" } } */
99
/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_sub" } } */

powered by: WebSVN 2.1.0

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