]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/gcc.target/powerpc/ppc-fma-4.c
rs6000: -mfused-madd cleanup
[gcc.git] / gcc / testsuite / gcc.target / powerpc / ppc-fma-4.c
CommitLineData
1b1562a5
MM
1/* { dg-do compile { target { powerpc*-*-* } } } */
2/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3/* { dg-require-effective-target powerpc_altivec_ok } */
d6613781 4/* { dg-options "-O3 -ftree-vectorize -mcpu=power6 -maltivec -ffast-math -ffp-contract=off" } */
1b1562a5
MM
5/* { dg-final { scan-assembler-times "vmaddfp" 1 } } */
6/* { dg-final { scan-assembler-times "fmadd " 1 } } */
7/* { dg-final { scan-assembler-times "fmadds" 1 } } */
8/* { dg-final { scan-assembler-times "fmsub " 1 } } */
9/* { dg-final { scan-assembler-times "fmsubs" 1 } } */
10/* { dg-final { scan-assembler-times "fnmadd " 1 } } */
11/* { dg-final { scan-assembler-times "fnmadds" 1 } } */
12/* { dg-final { scan-assembler-times "fnmsub " 1 } } */
13/* { dg-final { scan-assembler-times "fnmsubs" 1 } } */
14
15/* Only the functions calling the builtin should generate an appropriate
16 (a * b) + c instruction. */
17
18double
19builtin_fma (double b, double c, double d)
20{
21 return __builtin_fma (b, c, d); /* fmadd */
22}
23
24double
25builtin_fms (double b, double c, double d)
26{
27 return __builtin_fma (b, c, -d); /* fmsub */
28}
29
30double
31builtin_fnma (double b, double c, double d)
32{
33 return - __builtin_fma (b, c, d); /* fnmadd */
34}
35
36double
37builtin_fnms (double b, double c, double d)
38{
39 return - __builtin_fma (b, c, -d); /* fnmsub */
40}
41
42float
43builtin_fmaf (float b, float c, float d)
44{
45 return __builtin_fmaf (b, c, d); /* fmadds */
46}
47
48float
49builtin_fmsf (float b, float c, float d)
50{
51 return __builtin_fmaf (b, c, -d); /* fmsubs */
52}
53
54float
55builtin_fnmaf (float b, float c, float d)
56{
57 return - __builtin_fmaf (b, c, d); /* fnmadds */
58}
59
60float
61builtin_fnmsf (float b, float c, float d)
62{
63 return - __builtin_fmaf (b, c, -d); /* fnmsubs */
64}
65
66double
67normal_fma (double b, double c, double d)
68{
69 return (b * c) + d; /* fmul/fadd */
70}
71
72float
73normal_fmaf (float b, float c, float d)
74{
75 return (b * c) + d; /* fmuls/fadds */
76}
77
78#ifndef SIZE
79#define SIZE 1024
80#endif
81
82float vfa[SIZE] __attribute__((__aligned__(32)));
83float vfb[SIZE] __attribute__((__aligned__(32)));
84float vfc[SIZE] __attribute__((__aligned__(32)));
85float vfd[SIZE] __attribute__((__aligned__(32)));
86
87void
88vector_fmaf (void)
89{
90 int i;
91
92 for (i = 0; i < SIZE; i++)
93 vfa[i] = __builtin_fmaf (vfb[i], vfc[i], vfd[i]); /* vaddfp */
94}
This page took 0.122368 seconds and 5 git commands to generate.