From patchwork Thu Apr 29 21:48:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1471867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=RbwUbZrj; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FWTfV5DTzz9sXL for ; Fri, 30 Apr 2021 07:49:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AA003848409; Thu, 29 Apr 2021 21:49:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AA003848409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1619732942; bh=Mlt1uxq8xdpo161Ob2sSYRV/k0e6ODkUcbo8zBkBrGM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RbwUbZrj1SBsgDesR8iI8waPKiM9TgY6SFRH7xxmYvWaDVxWRy5344J3IL0iEsA0I g/Ku0xw063q+OUaVDOdSoC2gMib3d3U8uw2l5PtRcFYLFr3heoDv2bOEQEOnzlxlB+ eW5gUhmkozxeczAEyW+6XL7Vz5ARndIyvhEszgvM= 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 808583848407 for ; Thu, 29 Apr 2021 21:49:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 808583848407 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13TLY7nX065424; Thu, 29 Apr 2021 17:49:00 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3883txsp5y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Apr 2021 17:48:59 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 13TLbQru075718; Thu, 29 Apr 2021 17:48:58 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 3883txsp59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Apr 2021 17:48:58 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13TLm6ZH032544; Thu, 29 Apr 2021 21:48:57 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma03dal.us.ibm.com with ESMTP id 384ay9s1d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Apr 2021 21:48:57 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13TLmuB457278878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 21:48:56 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F994136055; Thu, 29 Apr 2021 21:48:56 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4B0313604F; Thu, 29 Apr 2021 21:48:55 +0000 (GMT) Received: from ibm-toto.the-meissners.org (unknown [9.160.105.177]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS; Thu, 29 Apr 2021 21:48:55 +0000 (GMT) Date: Thu, 29 Apr 2021 17:48:53 -0400 To: gcc-patches@gcc.gnu.org, Michael Meissner , Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Will Schmidt Subject: [PATCH, V2] Define KFmode constants for libgcc. Message-ID: <20210429214853.GA7892@ibm-toto.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Will Schmidt MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ImF9KtCPwblijimacoP4LcYzPQrNuqp5 X-Proofpoint-ORIG-GUID: aK82dwGK4x0Y2WTnLmJDuFLX1j07xBlp X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-29_11:2021-04-28, 2021-04-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104290137 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_DNSWL_LOW, 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-Patchwork-Original-From: Michael Meissner via Gcc-patches From: Michael Meissner Reply-To: Michael Meissner Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" [PATCH, V2] Define KFmode constants for libgcc. This patch defines the constants needed for libgcc for the PowerPC specific IEEE 128-bit floating point types (KFmode). The 4/28 changes to libgcc need these constants defined. We only define the KFmode constants if IEEE 128-bit floating point is supported, but long double does not use the IEEE 128-bit format. If long double uses the IEEE 128-bit format, it will use TFmode and not KFmode. With this patch, we don't have to modify _divkc3.c to use the FLT128 constants. Instead, the -fbuilting-libgcc option will build the appropriate __LIBGCC_KF_* macros. I have built a bootstrap compiler on a little endian power9 system and it finished. Previously it had crashed in building libgcc. I also build a non-bootstrap compiler where the default long double format is IEEE 128-bit and it built ok Can I check this into the trunk for GCC 12? gcc/ 2021-04-29 Michael Meissner PR bootstrap/100327 * config/rs6000/rs6000.c (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define. (rs6000_iibgcc_floating_mode_supported_p): New target hook. --- gcc/config/rs6000/rs6000.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index cdeb049986f..23485027d85 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1569,6 +1569,10 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_SCALAR_MODE_SUPPORTED_P #define TARGET_SCALAR_MODE_SUPPORTED_P rs6000_scalar_mode_supported_p +#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P +#define TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P \ + rs6000_libgccc_floating_mode_supported_p + #undef TARGET_VECTOR_MODE_SUPPORTED_P #define TARGET_VECTOR_MODE_SUPPORTED_P rs6000_vector_mode_supported_p @@ -24089,6 +24093,31 @@ rs6000_scalar_mode_supported_p (scalar_mode mode) return default_scalar_mode_supported_p (mode); } +/* Target hook for libgcc_floating_mode_supported_p. */ + +static bool +rs6000_libgccc_floating_mode_supported_p (scalar_float_mode mode) +{ + switch (mode) + { + case E_SFmode: + case E_DFmode: + case E_TFmode: + return true; + + /* We only return true for KFmode if IEEE 128-bit types are supported, and + if long double does not use the IEEE 128-bit format. If long double + uses the IEEE 128-bit format, it will use TFmode and not KFmode. + Because the code will not use KFmode in that case, there will be aborts + because it can't find KFmode in the Floatn types. */ + case E_KFmode: + return TARGET_FLOAT128_TYPE && !TARGET_IEEEQUAD; + + default: + return false; + } +} + /* Target hook for vector_mode_supported_p. */ static bool rs6000_vector_mode_supported_p (machine_mode mode)