From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 3B04F385843F; Sat, 5 Mar 2022 16:23:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B04F385843F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9639] Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: a1984704a7c2b9be8c89b3381e9c453ccbc5e7bf X-Git-Newrev: fa944e8660e158655beda58e12b69fd18dd49108 Message-Id: <20220305162354.3B04F385843F@sourceware.org> Date: Sat, 5 Mar 2022 16:23:54 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Mar 2022 16:23:54 -0000 https://gcc.gnu.org/g:fa944e8660e158655beda58e12b69fd18dd49108 commit r11-9639-gfa944e8660e158655beda58e12b69fd18dd49108 Author: Michael Meissner Date: Sat Mar 5 11:22:15 2022 -0500 Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__. Define the sizes of the PowerPC specific types __float128 and __ibm128 if those types are enabled. This patch will define __SIZEOF_IBM128__ and __SIZEOF_FLOAT128__ if their respective types are created in the compiler. Currently, this means both of these will be defined if float128 support is enabled. But at some point in the future, __ibm128 could be enabled without enabling float128 support and __SIZEOF_IBM128__ would be defined. 2022-03-05 Michael Meissner gcc/ PR target/99708 * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define __SIZEOF_IBM128__ if the IBM 128-bit long double type is created. Define __SIZEOF_FLOAT128__ if the IEEE 128-bit floating point type is created. Backport change made to the master branch on 2022-02-17. gcc/testsuite/ PR target/99708 * gcc.target/powerpc/pr99708.c: New test. Backport change made to the master branch on 2022-02-17. Diff: --- gcc/config/rs6000/rs6000-c.c | 6 +++++- gcc/testsuite/gcc.target/powerpc/pr99708.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index afcb5bb6e39..1b9822e806c 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -623,7 +623,11 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) if (TARGET_FRSQRTES) builtin_define ("__RSQRTEF__"); if (TARGET_FLOAT128_TYPE) - builtin_define ("__FLOAT128_TYPE__"); + builtin_define ("__FLOAT128_TYPE__"); + if (ibm128_float_type_node) + builtin_define ("__SIZEOF_IBM128__=16"); + if (ieee128_float_type_node) + builtin_define ("__SIZEOF_FLOAT128__=16"); #ifdef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB builtin_define ("__BUILTIN_CPU_SUPPORTS__"); #endif diff --git a/gcc/testsuite/gcc.target/powerpc/pr99708.c b/gcc/testsuite/gcc.target/powerpc/pr99708.c new file mode 100644 index 00000000000..d478f7bc4c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr99708.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { require-effective-target ppc_float128_sw } */ +/* { dg-options "-O2 -mvsx -mfloat128" } */ + +/* + * PR target/99708 + * + * Verify that __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__ are properly defined. + */ + +#include + +int main (void) +{ + if (__SIZEOF_FLOAT128__ != sizeof (__float128) + || __SIZEOF_IBM128__ != sizeof (__ibm128)) + abort (); + + return 0; +} +