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-fma.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
2
   and add instructions into vfmaddss, vfmsubss, vfnmaddss,
3
   vfnmsubss on FMA4 systems.  */
4
 
5
/* { dg-do compile } */
6
/* { dg-require-effective-target lp64 } */
7
/* { dg-options "-O2 -mfma4" } */
8
 
9
extern void exit (int);
10
 
11
float
12
flt_mul_add (float a, float b, float c)
13
{
14
  return (a * b) + c;
15
}
16
 
17
double
18
dbl_mul_add (double a, double b, double c)
19
{
20
  return (a * b) + c;
21
}
22
 
23
float
24
flt_mul_sub (float a, float b, float c)
25
{
26
  return (a * b) - c;
27
}
28
 
29
double
30
dbl_mul_sub (double a, double b, double c)
31
{
32
  return (a * b) - c;
33
}
34
 
35
float
36
flt_neg_mul_add (float a, float b, float c)
37
{
38
  return (-(a * b)) + c;
39
}
40
 
41
double
42
dbl_neg_mul_add (double a, double b, double c)
43
{
44
  return (-(a * b)) + c;
45
}
46
 
47
float
48
flt_neg_mul_sub (float a, float b, float c)
49
{
50
  return (-(a * b)) - c;
51
}
52
 
53
double
54
dbl_neg_mul_sub (double a, double b, double c)
55
{
56
  return (-(a * b)) - c;
57
}
58
 
59
float  f[10] = { 2, 3, 4 };
60
double d[10] = { 2, 3, 4 };
61
 
62
int main ()
63
{
64
  f[3] = flt_mul_add (f[0], f[1], f[2]);
65
  f[4] = flt_mul_sub (f[0], f[1], f[2]);
66
  f[5] = flt_neg_mul_add (f[0], f[1], f[2]);
67
  f[6] = flt_neg_mul_sub (f[0], f[1], f[2]);
68
 
69
  d[3] = dbl_mul_add (d[0], d[1], d[2]);
70
  d[4] = dbl_mul_sub (d[0], d[1], d[2]);
71
  d[5] = dbl_neg_mul_add (d[0], d[1], d[2]);
72
  d[6] = dbl_neg_mul_sub (d[0], d[1], d[2]);
73
  exit (0);
74
}
75
 
76
/* { dg-final { scan-assembler "vfmaddss" } } */
77
/* { dg-final { scan-assembler "vfmaddsd" } } */
78
/* { dg-final { scan-assembler "vfmsubss" } } */
79
/* { dg-final { scan-assembler "vfmsubsd" } } */
80
/* { dg-final { scan-assembler "vfnmaddss" } } */
81
/* { dg-final { scan-assembler "vfnmaddsd" } } */
82
/* { dg-final { scan-assembler "vfnmsubss" } } */
83
/* { dg-final { scan-assembler "vfnmsubsd" } } */

powered by: WebSVN 2.1.0

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