middle-end/57245 - honor -frounding-math in real truncation
authorRichard Biener <rguenther@suse.de>
Wed, 27 Oct 2021 12:27:40 +0000 (14:27 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 28 Oct 2021 09:28:42 +0000 (11:28 +0200)
commita84b9d5373c7e67fd0ab2a412c22162cdf969c91
treed3211aa3a240ba0ab3043df237ed2ac37a35f5a9
parenteed248bb8cc3091e8a9b2f73138c691396752438
middle-end/57245 - honor -frounding-math in real truncation

The following honors -frounding-math when converting a FP constant
to another FP type.

2021-10-27  Richard Biener  <rguenther@suse.de>

PR middle-end/57245
* fold-const.c (fold_convert_const_real_from_real): Honor
-frounding-math if the conversion is not exact.
* simplify-rtx.c (simplify_const_unary_operation): Do not
simplify FLOAT_TRUNCATE with sign dependent rounding.

* gcc.dg/torture/fp-double-convert-float-1.c: New testcase.
gcc/fold-const.c
gcc/simplify-rtx.c
gcc/testsuite/gcc.dg/torture/fp-double-convert-float-1.c [new file with mode: 0644]