]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Don't use TFmode for 128 bits fp constant in toc [PR110011]
authorKewen Lin <linkw@linux.ibm.com>
Mon, 12 Jun 2023 06:07:52 +0000 (01:07 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Mon, 19 Jun 2023 08:05:14 +0000 (03:05 -0500)
commita137fc8de056c7e0e93047b865bcc1948bd8ee03
treed1a1fa7ced525bb556a594f47ba451e020896fef
parenta7bef2942e8693eebd61b64612c0ebbba3ff39d5
rs6000: Don't use TFmode for 128 bits fp constant in toc [PR110011]

As PR110011 shows, when encoding 128 bits fp constant into
toc, we adopts REAL_VALUE_TO_TARGET_LONG_DOUBLE which is
to find the first float mode with LONG_DOUBLE_TYPE_SIZE
bits of precision, it would be TFmode here.  But the 128
bits fp constant can be with mode IFmode or KFmode, which
doesn't necessarily have the same underlying float format
as the one of TFmode, like this PR exposes, with option
-mabi=ibmlongdouble TFmode has ibm_extended_format while
KFmode has ieee_quad_format, mixing up the formats (the
encoding/decoding ways) would cause unexpected results.

This patch is to make it use constant's own mode instead
of TFmode for real_to_target call.

PR target/110011

gcc/ChangeLog:

* config/rs6000/rs6000.c (output_toc): Use the mode of the 128-bit
floating constant itself for real_to_target call.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr110011.c: New test.

(cherry picked from commit 388809f2afde874180da0669c669e241037eeba0)
gcc/config/rs6000/rs6000.c
gcc/testsuite/gcc.target/powerpc/pr110011.c [new file with mode: 0644]