| 1 |
/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */ |
| 2 |
/* { dg-skip-if "" { powerpc*-*-darwin* } } */ |
| 3 |
/* { dg-require-effective-target powerpc_fprs } */ |
| 4 |
/* { dg-options "-O2 -ffast-math -mdejagnu-cpu=power5 -mabi=no-altivec" } */ |
| 5 |
/* { dg-final { scan-assembler-times "fabs" 3 } } */ |
| 6 |
/* { dg-final { scan-assembler-times "fnabs" 3 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "fsel" 3 } } */ |
| 8 |
/* { dg-final { scan-assembler-times "fcpsgn" 4 } } */ |
| 9 |
/* { dg-final { scan-assembler-not "xscpsgndp" } } */ |
| 10 |
|
| 11 |
/* Like ppc-target-1.c, but do not enable the altivec abi on 32-bit, so the |
| 12 |
power7 code should generate fcpsgn and not xscpsgndp. */ |
| 13 |
|
| 14 |
double normal1 (double, double); |
| 15 |
double power5 (double, double) __attribute__((__target__("cpu=power5"))); |
| 16 |
double power6 (double, double) __attribute__((__target__("cpu=power6"))); |
| 17 |
double power6x (double, double) __attribute__((__target__("cpu=power6x"))); |
| 18 |
double power7 (double, double) __attribute__((__target__("cpu=power7"))); |
| 19 |
double power7n (double, double) __attribute__((__target__("cpu=power7,no-vsx"))); |
| 20 |
double normal2 (double, double); |
| 21 |
|
| 22 |
/* fabs/fnabs/fsel */ |
| 23 |
double normal1 (double a, double b) |
| 24 |
{ |
| 25 |
return __builtin_copysign (a, b); |
| 26 |
} |
| 27 |
|
| 28 |
/* fabs/fnabs/fsel */ |
| 29 |
double power5 (double a, double b) |
| 30 |
{ |
| 31 |
return __builtin_copysign (a, b); |
| 32 |
} |
| 33 |
|
| 34 |
/* fcpsgn */ |
| 35 |
double power6 (double a, double b) |
| 36 |
{ |
| 37 |
return __builtin_copysign (a, b); |
| 38 |
} |
| 39 |
|
| 40 |
/* fcpsgn */ |
| 41 |
double power6x (double a, double b) |
| 42 |
{ |
| 43 |
return __builtin_copysign (a, b); |
| 44 |
} |
| 45 |
|
| 46 |
/* xscpsgndp */ |
| 47 |
double power7 (double a, double b) |
| 48 |
{ |
| 49 |
return __builtin_copysign (a, b); |
| 50 |
} |
| 51 |
|
| 52 |
/* fcpsgn */ |
| 53 |
double power7n (double a, double b) |
| 54 |
{ |
| 55 |
return __builtin_copysign (a, b); |
| 56 |
} |
| 57 |
|
| 58 |
/* fabs/fnabs/fsel */ |
| 59 |
double normal2 (double a, double b) |
| 60 |
{ |
| 61 |
return __builtin_copysign (a, b); |
| 62 |
} |