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