fold-const: Treat fp conversion to a type with same mode as copy
authorKewen Lin <linkw@linux.ibm.com>
Wed, 21 Dec 2022 03:04:54 +0000 (21:04 -0600)
committerKewen Lin <linkw@linux.ibm.com>
Wed, 21 Dec 2022 03:04:54 +0000 (21:04 -0600)
commit94cf7a2d95bf6db873cdcc4085a697ad40057957
tree37ca3926fd5fcbb1e8d9ba22b476cbcc2dafb897
parent282462b39584ae49eaaa6f53bd44b6cfdc4ccbcb
fold-const: Treat fp conversion to a type with same mode as copy

In function fold_convert_const_real_from_real, when the modes of
two types involved in fp conversion are the same, we can simply
take it as copy, rebuild with the exactly same TREE_REAL_CST and
the target type.  It is more efficient and helps to avoid possible
unexpected signalling bit clearing in [1].

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608533.html

gcc/ChangeLog:

* fold-const.cc (fold_convert_const_real_from_real): Treat floating
point conversion to a type with same mode as copy instead of normal
convertFormat.
gcc/fold-const.cc