| 1 |
/* { dg-do compile { target lp64 } } */ |
| 2 |
/* { dg-options "-mvsx -O2 -ffast-math -std=gnu11" } */ |
| 3 |
/* { dg-additional-options "-mdejagnu-cpu=power9" { target { ! has_arch_pwr9 } } } */ |
| 4 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 5 |
/* { dg-require-effective-target float128 } */ |
| 6 |
|
| 7 |
/* Test to make sure the compiler handles the standard _Float128 functions that |
| 8 |
have hardware support in ISA 3.0/power9. */ |
| 9 |
|
| 10 |
#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 |
| 11 |
|
| 12 |
#ifndef __FP_FAST_FMAF128 |
| 13 |
#error "__FP_FAST_FMAF128 should be defined." |
| 14 |
#endif |
| 15 |
|
| 16 |
extern _Float128 copysignf128 (_Float128, _Float128); |
| 17 |
extern _Float128 sqrtf128 (_Float128); |
| 18 |
extern _Float128 fmaf128 (_Float128, _Float128, _Float128); |
| 19 |
extern _Float128 ceilf128 (_Float128); |
| 20 |
extern _Float128 floorf128 (_Float128); |
| 21 |
extern _Float128 truncf128 (_Float128); |
| 22 |
extern _Float128 roundf128 (_Float128); |
| 23 |
|
| 24 |
_Float128 |
| 25 |
do_copysign (_Float128 a, _Float128 b) |
| 26 |
{ |
| 27 |
return copysignf128 (a, b); |
| 28 |
} |
| 29 |
|
| 30 |
_Float128 |
| 31 |
do_sqrt (_Float128 a) |
| 32 |
{ |
| 33 |
return sqrtf128 (a); |
| 34 |
} |
| 35 |
|
| 36 |
_Float128 |
| 37 |
do_fma (_Float128 a, _Float128 b, _Float128 c) |
| 38 |
{ |
| 39 |
return fmaf128 (a, b, c); |
| 40 |
} |
| 41 |
|
| 42 |
_Float128 |
| 43 |
do_fms (_Float128 a, _Float128 b, _Float128 c) |
| 44 |
{ |
| 45 |
return fmaf128 (a, b, -c); |
| 46 |
} |
| 47 |
|
| 48 |
_Float128 |
| 49 |
do_nfma (_Float128 a, _Float128 b, _Float128 c) |
| 50 |
{ |
| 51 |
return -fmaf128 (a, b, c); |
| 52 |
} |
| 53 |
|
| 54 |
_Float128 |
| 55 |
do_nfms (_Float128 a, _Float128 b, _Float128 c) |
| 56 |
{ |
| 57 |
return -fmaf128 (a, b, -c); |
| 58 |
} |
| 59 |
|
| 60 |
_Float128 |
| 61 |
do_ceil (_Float128 a) |
| 62 |
{ |
| 63 |
return ceilf128 (a); |
| 64 |
} |
| 65 |
|
| 66 |
_Float128 |
| 67 |
do_floor (_Float128 a) |
| 68 |
{ |
| 69 |
return floorf128 (a); |
| 70 |
} |
| 71 |
|
| 72 |
_Float128 |
| 73 |
do_trunc (_Float128 a) |
| 74 |
{ |
| 75 |
return truncf128 (a); |
| 76 |
} |
| 77 |
|
| 78 |
_Float128 |
| 79 |
do_round (_Float128 a) |
| 80 |
{ |
| 81 |
return roundf128 (a); |
| 82 |
} |
| 83 |
|
| 84 |
/* { dg-final { scan-assembler {\mxscpsgnqp\M} } } */ |
| 85 |
/* { dg-final { scan-assembler {\mxssqrtqp\M} } } */ |
| 86 |
/* { dg-final { scan-assembler {\mxsmaddqp\M} } } */ |
| 87 |
/* { dg-final { scan-assembler {\mxsmsubqp\M} } } */ |
| 88 |
/* { dg-final { scan-assembler {\mxsnmaddqp\M} } } */ |
| 89 |
/* { dg-final { scan-assembler {\mxsnmsubqp\M} } } */ |
| 90 |
/* { dg-final { scan-assembler {\mxsrqpi\M} } } */ |
| 91 |
/* { dg-final { scan-assembler-not {\mbl\M} } } */ |