From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id AE614385700A for ; Fri, 30 Oct 2020 02:30:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AE614385700A Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09U22Jen053625; Thu, 29 Oct 2020 22:30:17 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 34fyqsatjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Oct 2020 22:30:17 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 09U26etT072116; Thu, 29 Oct 2020 22:30:17 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 34fyqsathw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Oct 2020 22:30:17 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09U2RNpq030886; Fri, 30 Oct 2020 02:30:16 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01dal.us.ibm.com with ESMTP id 34cbw9stgy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Oct 2020 02:30:16 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09U2UFpi47972820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Oct 2020 02:30:15 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 312D6124053; Fri, 30 Oct 2020 02:30:15 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EFEB124058; Fri, 30 Oct 2020 02:30:14 +0000 (GMT) Received: from ibm-toto.the-meissners.org (unknown [9.160.70.240]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTPS; Fri, 30 Oct 2020 02:30:14 +0000 (GMT) Date: Thu, 29 Oct 2020 22:30:13 -0400 From: Michael Meissner To: Segher Boessenkool Cc: Michael Meissner , gcc-patches@gcc.gnu.org, David Edelsohn , Bill Schmidt , Peter Bergner , Jeff Law , Jonathan Wakely Subject: Re: PowerPC: Update __float128 and __ibm128 error messages. Message-ID: <20201030023013.GA12721@ibm-toto.the-meissners.org> Mail-Followup-To: Michael Meissner , Segher Boessenkool , gcc-patches@gcc.gnu.org, David Edelsohn , Bill Schmidt , Peter Bergner , Jeff Law , Jonathan Wakely References: <20201022221135.GA12277@ibm-toto.the-meissners.org> <20201027232722.GO2672@gate.crashing.org> <20201029170325.GF10730@ibm-toto.the-meissners.org> <20201029191858.GF2672@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201029191858.GF2672@gate.crashing.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-10-29_12:2020-10-29, 2020-10-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 impostorscore=0 phishscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010300008 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Oct 2020 02:30:20 -0000 On Thu, Oct 29, 2020 at 02:18:58PM -0500, Segher Boessenkool wrote: > On Thu, Oct 29, 2020 at 01:03:25PM -0400, Michael Meissner wrote: > > On Tue, Oct 27, 2020 at 06:27:22PM -0500, Segher Boessenkool wrote: > > > > +/* { dg-do compile { target { powerpc*-*-linux* } } } */ > > > > > > Use *-*-linux* instead? (In all relevant tests.) > > > > Ok. > > > > > Is there any reason these tests should only run on Linux? If not, it > > > should not restrict itself like this; and if so, you may want another > > > selsector (something ieee128 perhaps), or at the very least add a > > > comment why you do this. > > > > Right now the float128 emulation is only built on Linux, because it needs the > > support in GLIBC. If/when other systems add support for float128 in there > > C/C++ libraries, we can widen the tests. > > It still helps to use some new selector -- you only have to change the > implementation of that when such a day will come, instead of 34638 > separate testcases. Also, it is good documentation, helping every > reader (people trying to make sense if the tests, for example). This is the patch that I commited, combining this patch with the patch to allow users with GLIBC 2.32 or newer to not get warnings if they change the long double type. Note, it turns out the patch submitted previously had other changes to the tests for the new power10 instructions (scalar-extract-exp-4, scalar-extract-sig-4, scalar-test-data-class-11, and scalar-test-neg-5). Those patches will be part of the re-implementation of those built-in functions. I did remove the line from float128-mix*.c: { dg-do compile { target { powerpc*-*-linux* } } } and I added: { dg-require-effective-target ppc_float128_sw } To more properly check whether we can do float128. Subject: [PATCH] PowerPC: Adjust float128/ibm128 warnings. This patch ccombines two patches: 1) If GLIBC is 2.32 or newer, and the language is C or C++, allow the user to change the long double type without having to use -Wno-psabi. 2) Adjust the warnings for intermixing __float128 and __ibm128 to accomidate the future change to allow long double to use the IEEE 128-bit format. gcc/ 2020-10-29 Michael Meissner * config/rs6000/rs6000.c (rs6000_option_override_internal): Allow long double type to be changed for C/C++ if glibc 2.32 or newer. (rs6000_invalid_binary_op): Update error messages about mixing IBM long double and IEEE 128-bit. gcc/testsuite/ 2020-10-27 Michael Meissner * gcc.target/powerpc/float128-mix-2.c: New test. * gcc.target/powerpc/float128-mix-3.c: New test. * gcc.target/powerpc/float128-mix.c: Update failure messages. --- gcc/config/rs6000/rs6000.c | 29 ++++++++----------- .../gcc.target/powerpc/float128-mix-2.c | 16 ++++++++++ .../gcc.target/powerpc/float128-mix-3.c | 16 ++++++++++ .../gcc.target/powerpc/float128-mix.c | 20 +++++++------ 4 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-3.c diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 4d528a39a37..bcd4c4a82b3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4158,8 +4158,15 @@ rs6000_option_override_internal (bool global_init_p) if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128) { + /* Determine if the user can change the default long double type at + compilation time. Only C and C++ support this, and you need GLIBC + 2.32 or newer. Only issue one warning. */ static bool warned_change_long_double; - if (!warned_change_long_double) + + if (!warned_change_long_double + && (!OPTION_GLIBC + || (!lang_GNU_C () && !lang_GNU_CXX ()) + || ((TARGET_GLIBC_MAJOR * 1000) + TARGET_GLIBC_MINOR) < 2032)) { warned_change_long_double = true; if (TARGET_IEEEQUAD) @@ -14392,22 +14399,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED, if (!TARGET_FLOAT128_CVT) { - if ((mode1 == KFmode && mode2 == IFmode) - || (mode1 == IFmode && mode2 == KFmode)) - return N_("__float128 and __ibm128 cannot be used in the same " - "expression"); - - if (TARGET_IEEEQUAD - && ((mode1 == IFmode && mode2 == TFmode) - || (mode1 == TFmode && mode2 == IFmode))) - return N_("__ibm128 and long double cannot be used in the same " - "expression"); - - if (!TARGET_IEEEQUAD - && ((mode1 == KFmode && mode2 == TFmode) - || (mode1 == TFmode && mode2 == KFmode))) - return N_("__float128 and long double cannot be used in the same " - "expression"); + if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2)) + || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2))) + return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating " + "point types"); } return NULL; diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c new file mode 100644 index 00000000000..61227132c20 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c @@ -0,0 +1,16 @@ +/* { dg-require-effective-target ppc_float128_sw } */ +/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */ + +/* Test to make sure that __float128 and long double do not generate errors if + long double uses the IEEE 128-bit format. */ +__float128 +add (__float128 a, long double b) +{ + return a+b; +} + +long double +sub (long double a, __float128 b) +{ + return a-b; +} diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c new file mode 100644 index 00000000000..a2582bb1035 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c @@ -0,0 +1,16 @@ +/* { dg-require-effective-target ppc_float128_sw } */ +/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */ + +/* Test to make sure that __float128 and __ibm128 cannot be combined + together. */ +__float128 +add (__float128 a, __ibm128 b) +{ + return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */ +} + +__ibm128 +sub (__ibm128 a, __float128 b) +{ + return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c index 71f840c9490..48e651cdba0 100644 --- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c @@ -1,15 +1,17 @@ -/* { dg-do compile { target { powerpc*-*-linux* } } } */ -/* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-options "-O2 -mvsx" } */ +/* { dg-require-effective-target ppc_float128_sw } */ +/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */ - -/* Test to make sure that __float128 and long double cannot be combined together. */ -__float128 add (__float128 a, long double b) +/* Test to make sure that __float128 and long double cannot be combined + together, when long double uses the IBM extended double format, and + __float128 uses the IEEE 128-bit format. */ +__float128 +add (__float128 a, long double b) { - return a+b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */ + return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */ } -__ibm128 sub (long double a, __float128 b) +long double +sub (long double a, __float128 b) { - return a-b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */ + return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */ } -- 2.22.0 -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.ibm.com, phone: +1 (978) 899-4797