2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / s390 / dfp-1.c
blob109d9fb63f8ebb013b7ea1d08ea44ac8379ba237
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. */
9 /* { dg-do run } */
10 /* { dg-options "-O3 -march=z10 -mzarch" } */
12 _Decimal32 __attribute__((noinline))
13 foo (_Decimal128 a)
15 return (_Decimal32)a;
18 int
19 main ()
21 if (foo (1.23456349999999999DL) != 1.234563DF)
22 __builtin_abort ();