aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
blob: e8a2de3636a141c9d96a1730f34bb61a5775d4b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O2 -ffast-math -mcpu=power5 -mabi=altivec" } */
/* { dg-final { scan-assembler-times "fabs" 3 } } */
/* { dg-final { scan-assembler-times "fnabs" 3 } } */
/* { dg-final { scan-assembler-times "fsel" 3 } } */
/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */

/* fabs/fnabs/fsel */
double normal1 (double a, double b) { return __builtin_copysign (a, b); }

#pragma GCC push_options
#pragma GCC target ("cpu=power5")
/* fabs/fnabs/fsel */
double power5 (double a, double b) { return __builtin_copysign (a, b); }
#pragma GCC pop_options

#pragma GCC target ("cpu=power6")
/* fcpsgn */
double power6 (double a, double b) { return __builtin_copysign (a, b); }
#pragma GCC reset_options

#pragma GCC target ("cpu=power6x")
/* fcpsgn */
double power6x (double a, double b) { return __builtin_copysign (a, b); }
#pragma GCC reset_options

#pragma GCC target ("cpu=power7")
/* xscpsgndp */
double power7 (double a, double b) { return __builtin_copysign (a, b); }
#pragma GCC reset_options

#pragma GCC target ("cpu=power7,no-vsx")
/* fcpsgn */
double power7n (double a, double b) { return __builtin_copysign (a, b); }
#pragma GCC reset_options

/* fabs/fnabs/fsel */
double normal2 (double a, double b) { return __builtin_copysign (a, b); }