From patchwork Wed Jul 10 17:25:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1958941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=qHWcicTM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WK4WV6WpNz1xqc for ; Thu, 11 Jul 2024 03:25:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 149DF384A414 for ; Wed, 10 Jul 2024 17:25:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 2E334386074B for ; Wed, 10 Jul 2024 17:25:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2E334386074B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2E334386074B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720632321; cv=none; b=MkIMKkTGNgAw3nnpFNNzjvWRhUf8TnPsj0meymb44W4vw3rW6Qq19wVkI+8iL0voYLl8JCiQOgKhwDYU572cGY9oQbrpOcPmC+uPlOhCPr937STVYbuzr4cLlEJhHB4AIwcaRZFJRUWHKtVMzfeZEBRD8tOAmHytIzAcZWkk1sM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720632321; c=relaxed/simple; bh=3tt6KI/6z3MjO/oWVuJ+AKWUuKgN9c0q6XaGeIUuQD8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=aE3fbXWsTlpKKzgGmKAwY/+wE0DiyUYnqyCez1nVqkMG2xEoqd+dfkoGOT2NhUTZ6HqEapNsZtrxfCMANx769953LE+1i2hRP/S64NMMJEgy4QUxH7hb28NHhtlNB0JtWNzOoaipkuzNI2SMPF3iUdi1bCJSkspXVQif9o3keNU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46AGwtct000705; Wed, 10 Jul 2024 17:25:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=pp1; bh=bat0lFwHtzDZX4JNjPyRsrNq/f65uYiSbtaoUeYu Fc4=; b=qHWcicTMmqobo+Zjii8/GOQRdTAjUJZbtAuT4Al2H0y3mvM7Yw4N3zqk ACj5n86AkPBKHbmd3MiL/N9MGlhYH2L6qVxoX1UkqpZQgIoEKKEkll2wXJnwXRdl ZvXuvdl8TuhyAc5Y6D2xDOiOJr+ybUkdfntO+rN92qN9lb4bGu1kdnzLt7UE6fsY msb0Je1QcPlSH97llrvKwFUT30hBu5pbaJXys4Tj5diuFoV1exWStQ9zD96gAsy+ CMgVfN2VnLZS/jMhyPVNu5926PGkMiHNf+E4TAnW7H3r9VfUflBRQU8v2nQumKzR rHaStYWPc+GVsVi1ejMA9k+VO+j9gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 409x9y024h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:25:18 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 46AHPHvC010021; Wed, 10 Jul 2024 17:25:18 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 409x9y024d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:25:17 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 46AFZ7HR013962; Wed, 10 Jul 2024 17:25:17 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 407gn0vmx4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:25:17 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 46AHPEqV25428622 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jul 2024 17:25:16 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F59758059; Wed, 10 Jul 2024 17:25:14 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8ABEE5805B; Wed, 10 Jul 2024 17:25:13 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.82.53]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Wed, 10 Jul 2024 17:25:13 +0000 (GMT) Date: Wed, 10 Jul 2024 13:25:11 -0400 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: [PATCH 1/2] PR 115800: Fix libgfortran build using --with-cpu=power5 Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3yB896-FOrP5laIDDWroAq4ky5CCh4D7 X-Proofpoint-GUID: -FDLJAhuq1WzW_kKOm4kgim5J5W9D81P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_12,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 phishscore=0 clxscore=1015 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100122 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org If you build a little endian compiler and select a default CPU of power5 (i.e. --with-cpu=power5), GCC cannot be built. The reason is that both the libgfortran and libstdc++-v3 libraries assume that all little endian powerpc builds support IEEE 128-bit floating point. However, if the default cpu does not support the VSX instruction set, then we cannot build the IEEE 128-bit libraries. This patch fixes the libgfortran library so if the GCC compiler does not support IEEE 128-bit floating point, the IEEE 128-bit floating point libraries are not built. A companion patch will fix the libstdc++-v3 library. I have built these patches on a little endian system, doing both normal builds, and making a build with a power5 default. There was no regression in the normal builds. I have also built a big endian GCC compiler and there was no regression there. Can I check this patch into the trunk? 2024-07-10 Michael Meissner libgfortran/ PR target/115800 * configure.ac (powerpc64le*-linux*): Check to see that the compiler uses VSX before enabling IEEE 128-bit support. * configure: Regenerate. * kinds-override.h (GFC_REAL_17): Add check for __VSX__. * libgfortran.h (POWER_IEEE128): Likewise. --- libgfortran/configure | 7 +++++-- libgfortran/configure.ac | 3 +++ libgfortran/kinds-override.h | 2 +- libgfortran/libgfortran.h | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libgfortran/configure b/libgfortran/configure index 11a1bc5f070..2708e5c7eca 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -5981,6 +5981,9 @@ if test "x$GCC" = "xyes"; then #if __SIZEOF_LONG_DOUBLE__ != 16 #error long double is double #endif + #if !defined(__VSX__) + #error VSX is not available + #endif int main () { @@ -12847,7 +12850,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12850 "configure" +#line 12853 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12953,7 +12956,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12956 "configure" +#line 12959 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index cca1ea0ea97..cfaeb9717ab 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -148,6 +148,9 @@ if test "x$GCC" = "xyes"; then AC_PREPROC_IFELSE( [AC_LANG_PROGRAM([[#if __SIZEOF_LONG_DOUBLE__ != 16 #error long double is double + #endif + #if !defined(__VSX__) + #error VSX is not available #endif]], [[(void) 0;]])], [AM_FCFLAGS="$AM_FCFLAGS -mabi=ibmlongdouble -mno-gnu-attribute"; diff --git a/libgfortran/kinds-override.h b/libgfortran/kinds-override.h index f6b4956c5ca..51f440e5323 100644 --- a/libgfortran/kinds-override.h +++ b/libgfortran/kinds-override.h @@ -30,7 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* Keep these conditions on one line so grep can filter it out. */ -#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_DOUBLE__ == 16 +#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_DOUBLE__ == 16 && defined(__VSX__) typedef _Float128 GFC_REAL_17; typedef _Complex _Float128 GFC_COMPLEX_17; #define HAVE_GFC_REAL_17 diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 5c59ec26e16..23660335243 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -104,7 +104,7 @@ typedef off_t gfc_offset; #endif #if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ \ - && defined __GLIBC_PREREQ + && defined __GLIBC_PREREQ && defined(__VSX__) #if __GLIBC_PREREQ (2, 32) #define POWER_IEEE128 1 #endif From patchwork Wed Jul 10 17:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1958942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=KXFXn7LL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WK4Xw5dQBz1xqc for ; Thu, 11 Jul 2024 03:26:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 089CF38471F6 for ; Wed, 10 Jul 2024 17:26:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 61AAC386074B for ; Wed, 10 Jul 2024 17:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61AAC386074B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 61AAC386074B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720632396; cv=none; b=fo6XqlBTHpiMmHjTnICwcvk9Tflbyb6EATzLZyEltxGOuNmc9g3WMdPbXoN0hQyEIOlsQb+3/RZbo/XLKDthDZn/6pZ/CGyThAL2E/36kL4dv3Oi9mYHryiSD/f3Iggg7JQyHXQ117zhJrWQReb7jYuCuz8H/+pAuAMWNImbhEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720632396; c=relaxed/simple; bh=UMjo0YG2nGkpXgMQm/9JMBfXhT6Q/qKrOp/vaFf36fY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=IJSlPrjSZetolZMnJe16Sf062H/3A930sATm+xt+e4x6gDtn1uImll+rFpxKTK2iAwxpKxFSIdnAs4DJ0Y1QbyfxYGAMVeFjy29ytop1ufsshm5/jAvNTRCN7vCXVtbn+5hfHY3aakqSnTyAZWYx1fXatQ88esqmoLykZzLk/Fs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46AH90OG015654; Wed, 10 Jul 2024 17:26:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=pp1; bh=/6k4Gf8GE6n/TaFhNR+uUpNSDT9FHYPg/sDUeG2d d6g=; b=KXFXn7LL/F6gb0bJR3CCsr8iyFw3RXvJWaJ72Kt37HeV9dCWxsUFWkWT GJg6unpolyD22HBaQW5rFw0G0sdqXZN+xSBQ3TzoeYuf+5+zP1xNXf1cNf0EE5e/ wxCWyFCYFsd04J8utwZUkICiXp8Cp/2Av/qBnYaD6N6wTXJWHFJgn32UMLl5kIAL dx2ls2O4pBZZ24CFCtNMSAo7m1cxahZ2bN6FRlvNrjjEa4fOM6+4LjEWg8YoF2qL 5iyLme9SCVFX3wz0AZW0b4GWtjlWVIzOffBh3bPPE9hAslgid/hrUWERhmB+whWU P8bBBtIM+Rcc4vBjlJJgfNCaIgWe/g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 409x9y02a4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:26:32 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 46AHMe2b005157; Wed, 10 Jul 2024 17:26:32 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 409x9y02a0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:26:32 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 46AEVZYV014001; Wed, 10 Jul 2024 17:26:31 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 407jy3c48w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 17:26:31 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 46AHQSCq1835774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jul 2024 17:26:30 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1343858054; Wed, 10 Jul 2024 17:26:28 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F5765805D; Wed, 10 Jul 2024 17:26:27 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.82.53]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Wed, 10 Jul 2024 17:26:27 +0000 (GMT) Date: Wed, 10 Jul 2024 13:26:25 -0400 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: [PATCH 2/2] PR 115800: Fix libstdc++-v3 on little endian powerpc using --with-cpu=power5 Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: d5UnjxZSloTNsbxj408u3jkxKabN7x0n X-Proofpoint-GUID: JOhuzUbZzg1RRzPWCA0YDPgYny5n30_j X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_12,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 bulkscore=0 mlxlogscore=980 impostorscore=0 phishscore=0 clxscore=1015 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100122 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org If you build a little endian compiler and select a default CPU of power5 (i.e. --with-cpu=power5), GCC cannot be built. The reason is that both the libgfortran and libstdc++-v3 libraries assume that all little endian powerpc builds support IEEE 128-bit floating point. However, if the default cpu does not support the VSX instruction set, then we cannot build the IEEE 128-bit libraries. This patch fixes the libstdc++-v3 library so if the GCC compiler does not support IEEE 128-bit floating point, the IEEE 128-bit floating point libraries are not built. A companion patch will fix the libgfortran library. I have built these patches on a little endian system, doing both normal builds, and making a build with a power5 default. There was no regression in the normal builds. I have also built a big endian GCC compiler and there was no regression there. Can I check this patch into the trunk? 2024-07-10 Michael Meissner libstdc++-v3/ PR target/115800 * configure.ac (powerpc*-*-linux*): Don't enable IEEE 128-bit on PowerPC systems without VSX. * configure: Regenerate. * numeric_traits.h: Don't enable IEEE 128-bit on PowerPC systems without VSX. --- libstdc++-v3/configure | 68 ++++++++++++++++------- libstdc++-v3/configure.ac | 58 +++++++++++-------- libstdc++-v3/include/ext/numeric_traits.h | 2 +- 3 files changed, 86 insertions(+), 42 deletions(-) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 5645e991af7..daab67f9dee 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -51355,8 +51355,31 @@ $as_echo "#define _GLIBCXX_LONG_DOUBLE_COMPAT 1" >>confdefs.h case "$target" in powerpc*-*-linux*) LONG_DOUBLE_COMPAT_FLAGS="$LONG_DOUBLE_COMPAT_FLAGS -mno-gnu-attribute" - # Check for IEEE128 support in libm: - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __frexpieee128 in -lm" >&5 + # Eliminate little endian systems without VSX + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #ifndef __VSX__ + #error "IEEE 128-bit needs VSX" + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_ieee128_possible=yes +else + ac_ieee128_possible=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_ieee128_possible = yes; then + # Check for IEEE128 support in libm: + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __frexpieee128 in -lm" >&5 $as_echo_n "checking for __frexpieee128 in -lm... " >&6; } if ${ac_cv_lib_m___frexpieee128+:} false; then : $as_echo_n "(cached) " >&6 @@ -51401,18 +51424,18 @@ else ac_ldbl_ieee128_in_libc=no fi - if test $ac_ldbl_ieee128_in_libc = yes; then - # Determine which long double format is the compiler's default: - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test $ac_ldbl_ieee128_in_libc = yes; then + # Determine which long double format is the compiler's default: + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { - #ifndef __LONG_DOUBLE_IEEE128__ - #error compiler defaults to ibm128 - #endif + #ifndef __LONG_DOUBLE_IEEE128__ + #error compiler defaults to ibm128 + #endif ; return 0; @@ -51424,21 +51447,28 @@ else ac_ldbl_ieee128_default=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # Library objects should use default long double format. - if test "$ac_ldbl_ieee128_default" = yes; then - LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" - # Except for the ones that explicitly use these flags: - LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ibmlongdouble -mno-gnu-attribute -Wno-psabi" - else - LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" - LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ieeelongdouble -mno-gnu-attribute -Wno-psabi" - fi + # Library objects should use default long double format. + if test "$ac_ldbl_ieee128_default" = yes; then + LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" + # Except for the ones that explicitly use these flags: + LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ibmlongdouble -mno-gnu-attribute -Wno-psabi" + else + LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" + LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ieeelongdouble -mno-gnu-attribute -Wno-psabi" + fi $as_echo "#define _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT 1" >>confdefs.h - port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/os/gnu-linux/ldbl-ieee128-extra.ver" - ac_ldbl_alt128_compat=yes + port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/os/gnu-linux/ldbl-ieee128-extra.ver" + ac_ldbl_alt128_compat=yes + else + ac_ldbl_alt128_compat=no + fi + + # IEEE 128-bit not possible else + acl_ldbl_ieee128_in_libc=no + acl_ldbl_ieee128_default=no ac_ldbl_alt128_compat=no fi ;; diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index ccb24a82be7..69f795bd453 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -479,31 +479,45 @@ case "$target" in case "$target" in powerpc*-*-linux*) LONG_DOUBLE_COMPAT_FLAGS="$LONG_DOUBLE_COMPAT_FLAGS -mno-gnu-attribute" - # Check for IEEE128 support in libm: - AC_CHECK_LIB(m, __frexpieee128, - [ac_ldbl_ieee128_in_libc=yes], - [ac_ldbl_ieee128_in_libc=no]) - if test $ac_ldbl_ieee128_in_libc = yes; then - # Determine which long double format is the compiler's default: - AC_TRY_COMPILE(, [ - #ifndef __LONG_DOUBLE_IEEE128__ - #error compiler defaults to ibm128 - #endif - ], [ac_ldbl_ieee128_default=yes], [ac_ldbl_ieee128_default=no]) - # Library objects should use default long double format. - if test "$ac_ldbl_ieee128_default" = yes; then - LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" - # Except for the ones that explicitly use these flags: - LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ibmlongdouble -mno-gnu-attribute -Wno-psabi" + # Eliminate little endian systems without VSX + AC_TRY_COMPILE(, [ + #ifndef __VSX__ + #error "IEEE 128-bit needs VSX" + #endif + ], [ac_ieee128_possible=yes], [ac_ieee128_possible=no]) + if test $ac_ieee128_possible = yes; then + # Check for IEEE128 support in libm: + AC_CHECK_LIB(m, __frexpieee128, + [ac_ldbl_ieee128_in_libc=yes], + [ac_ldbl_ieee128_in_libc=no]) + if test $ac_ldbl_ieee128_in_libc = yes; then + # Determine which long double format is the compiler's default: + AC_TRY_COMPILE(, [ + #ifndef __LONG_DOUBLE_IEEE128__ + #error compiler defaults to ibm128 + #endif + ], [ac_ldbl_ieee128_default=yes], [ac_ldbl_ieee128_default=no]) + # Library objects should use default long double format. + if test "$ac_ldbl_ieee128_default" = yes; then + LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" + # Except for the ones that explicitly use these flags: + LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ibmlongdouble -mno-gnu-attribute -Wno-psabi" + else + LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" + LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ieeelongdouble -mno-gnu-attribute -Wno-psabi" + fi + AC_DEFINE([_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT],1, + [Define if compatibility should be provided for alternative 128-bit long double formats.]) + port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/os/gnu-linux/ldbl-ieee128-extra.ver" + ac_ldbl_alt128_compat=yes else - LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute" - LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ieeelongdouble -mno-gnu-attribute -Wno-psabi" + ac_ldbl_alt128_compat=no fi - AC_DEFINE([_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT],1, - [Define if compatibility should be provided for alternative 128-bit long double formats.]) - port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/os/gnu-linux/ldbl-ieee128-extra.ver" - ac_ldbl_alt128_compat=yes + + # IEEE 128-bit not possible else + acl_ldbl_ieee128_in_libc=no + acl_ldbl_ieee128_default=no ac_ldbl_alt128_compat=no fi ;; diff --git a/libstdc++-v3/include/ext/numeric_traits.h b/libstdc++-v3/include/ext/numeric_traits.h index b2723bfabfa..0f00abb3db6 100644 --- a/libstdc++-v3/include/ext/numeric_traits.h +++ b/libstdc++-v3/include/ext/numeric_traits.h @@ -218,7 +218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __numeric_traits<__ibm128> : public __numeric_traits_floating<__ibm128> { }; -# elif defined __LONG_DOUBLE_IBM128__ +# elif defined __LONG_DOUBLE_IBM128__ && defined __VSX__ // long double is __ibm128, define traits for __ieee128 template<> struct __numeric_traits_floating<__ieee128>