S/390: Use proper rounding mode for DFP to BFD conversions
authorAndreas Krebbel <krebbel@linux.ibm.com>
Wed, 12 Sep 2018 10:58:42 +0000 (10:58 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 12 Sep 2018 10:58:42 +0000 (10:58 +0000)
commitced8d882349226b8c566914826e8f59961240ad1
tree943924130bdc7526d1cfc789e2cefae0cb95d32d
parent7e7a6ed74d33c5bf28cd1d8e6e855373aec13b19
S/390: Use proper rounding mode for DFP to BFD conversions

According to IEEE 754 2008 4.3 'Rounding-direction attributes' the
rounding mode of the target format needs to be used. By not setting
the value so far we have always used the DFP rounding mode.

gcc/ChangeLog:

2018-09-12  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.md (PFPO_RND_MODE_DFP, PFPO_RND_MODE_BFP): New
constants.
("trunc<BFP:mode><DFP_ALL:mode>2")
("trunc<DFP_ALL:mode><BFP:mode>2")
("extend<BFP:mode><DFP_ALL:mode>2")
("extend<DFP_ALL:mode><BFP:mode>2"): Set proper rounding mode
according to the target operand type.

gcc/testsuite/ChangeLog:

2018-09-12  Andreas Krebbel  <krebbel@linux.ibm.com>

* gcc.target/s390/dfp_to_bfp_rounding.c: New test.

From-SVN: r264234
gcc/ChangeLog
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/dfp_to_bfp_rounding.c [new file with mode: 0644]