Message ID | Yg2C2fyd9hiX6zEK@toto.the-meissners.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2D173858017 for <patchwork@sourceware.org>; Wed, 16 Feb 2022 23:10:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2D173858017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1645053048; bh=OJHO1ayO1K0Jt1+OM4rageGxk53eaK6xS4bFsqmXczg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UEjNi5ubciwQt5CSM4uRYaI4OEWQb3ho6Q840aDm+6XylqHI9ac1+UsbNLYn6+39W +L26c730oiTSbJoWESKSV5AQrCxTDHC726xQz0Yp3lL3ytaOTI4qHAvScDEJ+1+F9y 1yEEGhh2PKy2oECPYuW+yXQKWPhM74RZs60aJ3ho= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 18119385840E for <gcc-patches@gcc.gnu.org>; Wed, 16 Feb 2022 23:10:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18119385840E Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21GN9ZiR001334; Wed, 16 Feb 2022 23:10:17 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9aab896x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 23:10:16 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21GNAFFb003563; Wed, 16 Feb 2022 23:10:16 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9aab896d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 23:10:15 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21GN8n6e010267; Wed, 16 Feb 2022 23:10:14 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma05wdc.us.ibm.com with ESMTP id 3e64hbjpfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 23:10:14 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21GNACIH17039712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Feb 2022 23:10:12 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B20D413631D; Wed, 16 Feb 2022 23:03:55 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 217E6136301; Wed, 16 Feb 2022 23:03:55 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.77.136.59]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS; Wed, 16 Feb 2022 23:03:55 +0000 (GMT) Date: Wed, 16 Feb 2022 18:03:53 -0500 To: gcc-patches@gcc.gnu.org, Michael Meissner <meissner@linux.ibm.com>, Segher Boessenkool <segher@kernel.crashing.org>, David Edelsohn <dje.gcc@gmail.com>, Bill Schmidt <wschmidt@linux.ibm.com>, Peter Bergner <bergner@linux.ibm.com>, Will Schmidt <will_schmidt@vnet.ibm.com> Subject: [PATCH, V3] PR target/99708- Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__ Message-ID: <Yg2C2fyd9hiX6zEK@toto.the-meissners.org> Mail-Followup-To: Michael Meissner <meissner@linux.ibm.com>, gcc-patches@gcc.gnu.org, Segher Boessenkool <segher@kernel.crashing.org>, David Edelsohn <dje.gcc@gmail.com>, Bill Schmidt <wschmidt@linux.ibm.com>, Peter Bergner <bergner@linux.ibm.com>, Will Schmidt <will_schmidt@vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: i-W5iZMme-ic7Gfqn4D-Ugnt3Lv_diKg X-Proofpoint-GUID: FznBfB43DGgzigsKV8qN7Q1RARu5jnh3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-16_10,2022-02-16_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxlogscore=723 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160125 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, KAM_SHORT, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Michael Meissner via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Michael Meissner <meissner@linux.ibm.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[V3] PR target/99708- Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__
|
|
Commit Message
Michael Meissner
Feb. 16, 2022, 11:03 p.m. UTC
[PATCH, V3] 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. I have tested this on a little endian power9 system and there were no regressions. I did verify by hand that if I compile with -mno-vsx, that __SIZEOF_IBM128__ is not defined. Can I check this into the master branch? Ideally, it should also be backported to GCC 11 and 10. 2022-02-16 Michael Meissner <meissner@the-meissners.org> gcc/ PR target/99708 * config/rs6000/rs6000-c.cc (rs6000_cpu_cpp_builtins): Define __SIZEOF_IBM128__ if the IBM 128-bit long double type is created. Define __SIZEOF_FLOAT128__ if we have float128 support. gcc/testsuite/ PR target/99708 * gcc.target/powerpc/pr99708.c: New test. --- gcc/config/rs6000/rs6000-c.cc | 7 ++++++- gcc/testsuite/gcc.target/powerpc/pr99708.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr99708.c
Comments
Hi! On Wed, Feb 16, 2022 at 06:03:53PM -0500, Michael Meissner wrote: > [PATCH, V3] 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. > gcc/ > PR target/99708 > * config/rs6000/rs6000-c.cc (rs6000_cpu_cpp_builtins): Define > __SIZEOF_IBM128__ if the IBM 128-bit long double type is created. > Define __SIZEOF_FLOAT128__ if we have float128 support. > --- a/gcc/config/rs6000/rs6000-c.cc > +++ b/gcc/config/rs6000/rs6000-c.cc > @@ -622,8 +622,13 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) > builtin_define ("__RSQRTE__"); > if (TARGET_FRSQRTES) > builtin_define ("__RSQRTEF__"); > + if (ibm128_float_type_node) > + builtin_define ("__SIZEOF_IBM128__=16"); > if (TARGET_FLOAT128_TYPE) > - builtin_define ("__FLOAT128_TYPE__"); > + { > + builtin_define ("__FLOAT128_TYPE__"); > + builtin_define ("__SIZEOF_FLOAT128__=16"); > + } if (TARGET_FLOAT128_TYPE) builtin_define ("__FLOAT128_TYPE__"); if (float128_type_node) builtin_define ("__SIZEOF_FLOAT128__=16"); if (ibm128_float_type_node) builtin_define ("__SIZEOF_IBM128__=16"); Okay like that. Thanks! Segher
The version of this patch applied to GCC 10 branch (commit 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC 10 branch is broken) <https://sourceware.org/pipermail/libc-testresults/2022q1/009444.html>. Specifically, the test program links-dso-program.cc built during the glibc build no longer builds, with a series of errors in libstdc++ headers such as: /scratch/jmyers/glibc/many10/install/compilers/powerpc64le-linux-gnu/powerpc64le-glibc-linux-gnu/include/c++/10.3.1/type_traits:387:39: error: '__float128' was not declared in this scope 387 | struct __is_floating_point_helper<__float128> | ^~~~~~~~~~ So it appears that with the GCC 10 version, there is some inconsistency between what the compiler defines and what the headers expect. This file in glibc is built with the following command: powerpc64le-glibc-linux-gnu-g++ links-dso-program.cc -c -I/scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/ -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute -mlong-double-128 -fpie -mno-float128 -I../include -I/scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/support -I/scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/le/fpu -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/le -I../sysdeps/unix/sysv/linux/powerpc/powerpc64 -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/powerpc/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch -I../sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch -I../sysdeps/powerpc/powerpc64/le/fpu/multiarch -I../sysdeps/powerpc/powerpc64/le/power8/fpu -I../sysdeps/powerpc/powerpc64/le/power7/fpu -I../sysdeps/powerpc/powerpc64/le/fpu -I../sysdeps/powerpc/powerpc64/fpu -I../sysdeps/powerpc/powerpc64/le/power8/multiarch -I../sysdeps/powerpc/powerpc64/le/power7/multiarch -I../sysdeps/powerpc/powerpc64/le/multiarch -I../sysdeps/powerpc/powerpc64/multiarch -I../sysdeps/powerpc/powerpc64/le/power8 -I../sysdeps/powerpc/powerpc64/power8 -I../sysdeps/powerpc/powerpc64/le/power7 -I../sysdeps/powerpc/powerpc64/power7 -I../sysdeps/powerpc/powerpc64/power6 -I../sysdeps/powerpc/powerpc64/power4 -I../sysdeps/powerpc/power4 -I../sysdeps/powerpc/powerpc64/le -I../sysdeps/powerpc/powerpc64 -I../sysdeps/wordsize-64 -I../sysdeps/powerpc/fpu -I../sysdeps/powerpc -I../sysdeps/ieee754/ldbl-128ibm-compat -I../sysdeps/ieee754/ldbl-128ibm/include -I../sysdeps/ieee754/ldbl-128ibm -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=nonlib -include ../include/libc-symbols.h -DPIC -DTOP_NAMESPACE=glibc -o /scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/support/links-dso-program.o -MD -MP -MF /scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/support/links-dso-program.o.dt -MT /scratch/jmyers/glibc/many10/build/glibcs/powerpc64le-linux-gnu/glibc/support/links-dso-program.o
On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > The version of this patch applied to GCC 10 branch (commit > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > 10 branch is broken) Mike, please revert it then? Segher
On Fri, Mar 11, 2022 at 02:51:23PM -0600, Segher Boessenkool wrote: > On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > > The version of this patch applied to GCC 10 branch (commit > > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > > 10 branch is broken) > > Mike, please revert it then? Preferably also the GCC 11 commit, because otherwise it needs backports of the follow-up changes too. Jakub
On Fri, Mar 11, 2022 at 09:57:50PM +0100, Jakub Jelinek wrote: > On Fri, Mar 11, 2022 at 02:51:23PM -0600, Segher Boessenkool wrote: > > On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > > > The version of this patch applied to GCC 10 branch (commit > > > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > > > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > > > 10 branch is broken) > > > > Mike, please revert it then? > > Preferably also the GCC 11 commit, because otherwise it needs backports > of the follow-up changes too. Good point. Yes please. Segher
On Fri, Mar 11, 2022 at 02:51:23PM -0600, Segher Boessenkool wrote: > On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > > The version of this patch applied to GCC 10 branch (commit > > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > > 10 branch is broken) > > Mike, please revert it then? Ok, I will revert both the GCC 11 and GCC 10 backport once I make sure the fix builds. Sorry about that. Obviously, we will want to backport whatever we do shortly to the older branches.
On Fri, Mar 11, 2022 at 03:07:39PM -0600, Segher Boessenkool wrote: > On Fri, Mar 11, 2022 at 09:57:50PM +0100, Jakub Jelinek wrote: > > On Fri, Mar 11, 2022 at 02:51:23PM -0600, Segher Boessenkool wrote: > > > On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > > > > The version of this patch applied to GCC 10 branch (commit > > > > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > > > > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > > > > 10 branch is broken) > > > > > > Mike, please revert it then? > > > > Preferably also the GCC 11 commit, because otherwise it needs backports > > of the follow-up changes too. > > Good point. Yes please. Both GCC 10 and GCC 11 reverted.
On Fri, Mar 11, 2022 at 05:51:05PM -0500, Michael Meissner wrote: > On Fri, Mar 11, 2022 at 02:51:23PM -0600, Segher Boessenkool wrote: > > On Fri, Mar 11, 2022 at 08:42:27PM +0000, Joseph Myers wrote: > > > The version of this patch applied to GCC 10 branch (commit > > > 641b407763ecfee5d4ac86d8ffe9eb1eeea5fd10) has broken the glibc build for > > > powerpc64le-linux-gnu (it's fine with GCC 11 branch and master, just GCC > > > 10 branch is broken) > > > > Mike, please revert it then? > > Ok, I will revert both the GCC 11 and GCC 10 backport once I make sure the fix > builds. Sorry about that. Obviously, we will want to backport whatever we do > shortly to the older branches. Yes, except the "shortly". Experience shows that we need more thorough testing for this, which means we need to wait longer, so that other projects have time to do their testing. Rushing things only causes more problems :-/ Segher
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index 15251efc209..ec4e5c3f53a 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -622,8 +622,13 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) builtin_define ("__RSQRTE__"); if (TARGET_FRSQRTES) builtin_define ("__RSQRTEF__"); + if (ibm128_float_type_node) + builtin_define ("__SIZEOF_IBM128__=16"); if (TARGET_FLOAT128_TYPE) - builtin_define ("__FLOAT128_TYPE__"); + { + builtin_define ("__FLOAT128_TYPE__"); + 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 <stdlib.h> + +int main (void) +{ + if (__SIZEOF_FLOAT128__ != sizeof (__float128) + || __SIZEOF_IBM128__ != sizeof (__ibm128)) + abort (); + + return 0; +} +