| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mlsx -ffp-int-builtin-inexact" } */ |
| 3 |
|
| 4 |
#define test(func, suffix) \ |
| 5 |
__typeof__ (1.##suffix) \ |
| 6 |
_##func##suffix (__typeof__ (1.##suffix) x) \ |
| 7 |
{ \ |
| 8 |
return __builtin_##func##suffix (x); \ |
| 9 |
} |
| 10 |
|
| 11 |
test (ceil, f) |
| 12 |
test (ceil, ) |
| 13 |
test (floor, f) |
| 14 |
test (floor, ) |
| 15 |
test (trunc, f) |
| 16 |
test (trunc, ) |
| 17 |
test (roundeven, f) |
| 18 |
test (roundeven, ) |
| 19 |
test (nearbyint, f) |
| 20 |
test (nearbyint, ) |
| 21 |
test (rint, f) |
| 22 |
test (rint, ) |
| 23 |
|
| 24 |
/* { dg-final { scan-assembler "\tvfrintrp\.s" } } */ |
| 25 |
/* { dg-final { scan-assembler "\tvfrintrm\.s" } } */ |
| 26 |
/* { dg-final { scan-assembler "\tvfrintrz\.s" } } */ |
| 27 |
/* { dg-final { scan-assembler "\tvfrintrne\.s" } } */ |
| 28 |
/* { dg-final { scan-assembler "\tvfrintrp\.d" } } */ |
| 29 |
/* { dg-final { scan-assembler "\tvfrintrm\.d" } } */ |
| 30 |
/* { dg-final { scan-assembler "\tvfrintrz\.d" } } */ |
| 31 |
/* { dg-final { scan-assembler "\tvfrintrne\.d" } } */ |
| 32 |
|
| 33 |
/* must do vreplvei first */ |
| 34 |
/* { dg-final { scan-assembler-times "\tvreplvei\.w\t\\\$vr0,\\\$vr0,0" 4 } } */ |
| 35 |
/* { dg-final { scan-assembler-times "\tvreplvei\.d\t\\\$vr0,\\\$vr0,0" 4 } } */ |
| 36 |
|
| 37 |
/* nearbyint is not allowed to rasie FE_INEXACT for decades */ |
| 38 |
/* { dg-final { scan-assembler "\tb\t%plt\\(nearbyint\\)" } } */ |
| 39 |
/* { dg-final { scan-assembler "\tb\t%plt\\(nearbyintf\\)" } } */ |
| 40 |
|
| 41 |
/* rint should just use basic FP operation */ |
| 42 |
/* { dg-final { scan-assembler "\tfrint\.s" } } */ |
| 43 |
/* { dg-final { scan-assembler "\tfrint\.d" } } */ |