| 1 |
/* We do not have a direct conversion instruction from 128 bit DFP to |
| 2 |
32 bit DFP so this needs to be done in two steps. The first needs |
| 3 |
to be done with the "prepare for shorter precision rounding mode" |
| 4 |
in order to produce a correct result. Otherwise the 8th digit of |
| 5 |
the number will change from 4 to 5 in the first rounding step which |
| 6 |
then will turn the last digit of the 32 bit DFP number (the 3) into |
| 7 |
a 4. Although with direct rounding it would stay a 3. */ |
| 8 |
|
| 9 |
/* { dg-do run } */ |
| 10 |
/* { dg-options "-O3 -march=z10 -mzarch" } */ |
| 11 |
|
| 12 |
_Decimal32 __attribute__((noinline)) |
| 13 |
foo (_Decimal128 a) |
| 14 |
{ |
| 15 |
return (_Decimal32)a; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
main () |
| 20 |
{ |
| 21 |
if (foo (1.23456349999999999DL) != 1.234563DF) |
| 22 |
__builtin_abort (); |
| 23 |
} |