From patchwork Thu Jul 4 07:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1956719 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=EsNpxk9b; 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 4WF8bl03hgz1xpP for ; Thu, 4 Jul 2024 18:15:43 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F720384A48D for ; Thu, 4 Jul 2024 08:15: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 2839A3858C41 for ; Thu, 4 Jul 2024 08:14:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2839A3858C41 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 2839A3858C41 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=1720080883; cv=none; b=DlVmwAlsXB1bDZcj/2Gmcwzsu5xla1Eh+qGh3aH1xNjrjVw+odFh1aD9GIlnHK3fqswCT44NqkplCMCgidlpULLvvetZx9wRs6Kp1SrHaqgPBeyQ4eJDx/YGE5co1HPGmzNkg5bn+69fAgaoZbh3F9PoEJqwSc1OElYdJeVhpI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720080883; c=relaxed/simple; bh=TMA8ZDN7G7OjSlIAx/RY0z4XgjBjK/cvBZsgZYTnSDc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=CSmv7HyG0KJbD3OWoq16QU4vfDfXv4AoB59p0TIVs2cbeLm4di5yda5Y7EgIg4kMfW8SzyzWCm0KlEGMt1wTbO1Ns68PR5OyIfCdiqxQ0ILXELdVK19czQxgX8X3HxImWlHIom6c00+KBSGDsH0QaGpKEWdYB7Mx0yBFit3YK7c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4647xNUa002593; Thu, 4 Jul 2024 08:14:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:from:subject:to:cc:content-type :content-transfer-encoding; s=pp1; bh=lqCrwHPbspRJQf+9EGBtwmzBUd 9XuOaS++K3hP63KOQ=; b=EsNpxk9b3YX8tBto5l9K5E6aBRA1nU1V8Xfw9kJn9N b4a94fvubgjeQBmRGnZE3AhU5Z68fzCfRjaZAnK8srL/mSktOXsG/G0Z0ZkZh/3Q Khwk4GlNT/JeU4S4DscN0qzeAO+6iHTvqeBftxnhr2eOPARl7lgjzPPaFud2Or1b tR3buQrHZpRzgrn5gGm3PSZpiGBWNvwST3n1gyVRjkKoJ2Q9XIJSSRQDz5Zsa3ik N9CWb4ltt4J9886Luyg66lodS5DofjU8IyyIC5Kd1l/kivsvUO9IYocsSjYc92Yz Eg7mNlFHMrQlz7K2LZU7I34MTNcd50MLmyJQ/zV2ESCA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 405qtk818f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:14:35 +0000 (GMT) Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4648EZfQ026249; Thu, 4 Jul 2024 08:14:35 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 405qtk818c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:14:35 +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 4646m1rI009150; Thu, 4 Jul 2024 07:57:24 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 402w00y7ht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 07:57:23 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4647vKIE53543350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Jul 2024 07:57:22 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AD472004B; Thu, 4 Jul 2024 07:57:20 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DF3120040; Thu, 4 Jul 2024 07:57:18 +0000 (GMT) Received: from [9.200.158.244] (unknown [9.200.158.244]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 4 Jul 2024 07:57:17 +0000 (GMT) Message-ID: Date: Thu, 4 Jul 2024 15:57:17 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US From: "Kewen.Lin" Subject: [PATCH 1/3] expr: Allow same precision modes conversion between {ibm_extended, ieee_quad}_format [PR112993] To: GCC Patches Cc: Richard Biener , Richard Sandiford , Jakub Jelinek , "Joseph S. Myers" , Segher Boessenkool , Peter Bergner X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gB01vIw_xwgO8gOEQqQx6EpIx251GVYD X-Proofpoint-ORIG-GUID: sB-ffA1Q2W5kIZwBfpicec_BFFG3c8xK 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-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 impostorscore=0 mlxlogscore=416 mlxscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040054 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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 Hi, With some historical reasons, rs6000 defines KFmode, TFmode and IFmode to have different mode precision, but it causes some issues and needs some workarounds such as r14-6478 for PR112788. So we are going to make all rs6000 128 bit scalar FP modes have 128 bit precision. Be prepared for that, this patch is to make function convert_mode_scalar allow same precision FP modes conversion if their underlying formats are ibm_extended_format and ieee_quad_format respectively, just like the existing special treatment on arm_bfloat_half_format <-> ieee_half_format. It also factors out all the relevant checks into a lambda function. Bootstrapped and regtested on x86_64-redhat-linux and powerpc64{,le}-linux-gnu. Is it ok for trunk? BR, Kewen ----- PR target/112993 gcc/ChangeLog: * expr.cc (convert_mode_scalar): Allow same precision conversion between scalar floating point modes if whose underlying format is ibm_extended_format or ieee_quad_format, and refactor assertion with new lambda function acceptable_same_precision_modes. --- gcc/expr.cc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) -- 2.39.1 diff --git a/gcc/expr.cc b/gcc/expr.cc index ffbac513692..eac4dcc982e 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -338,6 +338,29 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp) enum rtx_code equiv_code = (unsignedp < 0 ? UNKNOWN : (unsignedp ? ZERO_EXTEND : SIGN_EXTEND)); + auto acceptable_same_precision_modes + = [] (scalar_mode from_mode, scalar_mode to_mode) -> bool + { + if (DECIMAL_FLOAT_MODE_P (from_mode) != DECIMAL_FLOAT_MODE_P (to_mode)) + return true; + + /* arm_bfloat_half_format <-> ieee_half_format */ + if ((REAL_MODE_FORMAT (from_mode) == &arm_bfloat_half_format + && REAL_MODE_FORMAT (to_mode) == &ieee_half_format) + || (REAL_MODE_FORMAT (to_mode) == &arm_bfloat_half_format + && REAL_MODE_FORMAT (from_mode) == &ieee_half_format)) + return true; + + /* ibm_extended_format <-> ieee_quad_format */ + if ((REAL_MODE_FORMAT (from_mode) == &ibm_extended_format + && REAL_MODE_FORMAT (to_mode) == &ieee_quad_format) + || (REAL_MODE_FORMAT (from_mode) == &ieee_quad_format + && REAL_MODE_FORMAT (to_mode) == &ibm_extended_format)) + return true; + + return false; + }; + if (to_real) { rtx value; @@ -346,12 +369,7 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp) gcc_assert ((GET_MODE_PRECISION (from_mode) != GET_MODE_PRECISION (to_mode)) - || (DECIMAL_FLOAT_MODE_P (from_mode) - != DECIMAL_FLOAT_MODE_P (to_mode)) - || (REAL_MODE_FORMAT (from_mode) == &arm_bfloat_half_format - && REAL_MODE_FORMAT (to_mode) == &ieee_half_format) - || (REAL_MODE_FORMAT (to_mode) == &arm_bfloat_half_format - && REAL_MODE_FORMAT (from_mode) == &ieee_half_format)); + || acceptable_same_precision_modes (from_mode, to_mode)); if (GET_MODE_PRECISION (from_mode) == GET_MODE_PRECISION (to_mode)) { From patchwork Thu Jul 4 08:20:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1956720 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=PAAYIfKC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4WF8k256Lgz1xql for ; Thu, 4 Jul 2024 18:21:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B49A3384A48F for ; Thu, 4 Jul 2024 08:21:12 +0000 (GMT) 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 A03213858C41 for ; Thu, 4 Jul 2024 08:20:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A03213858C41 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 A03213858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720081229; cv=none; b=JEW6OEUPFyXlmB6Zw86LkNa2aTmYpC7TYEznqxSMGwHpdZoI64n5+7ajV0o2EYXcV17n9F7KOa7TZvCIUO8YkMsqnlb1+4L2AzocMeHQV1R21cFMR2GVAQswFGbtYv9FJQ/oWhXCUaycV3//CLNdJJ2tpCno/QYAZhykKUnmqSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720081229; c=relaxed/simple; bh=YbRhj5KUdBuElsQyLqB3soO0599t3WHP3kHPP8CS0JI=; h=DKIM-Signature:Message-ID:Date:Subject:From:To:MIME-Version; b=J0Qgow89/+EIbDVuv0OFGjoAJaCHKOfTOSiCZEYHHI9/NcvMEEUwmnjF0NRXI+yGNqk6Vv9Gcsvt9/JWR32CMhBNVwH7IehdUi7VuvBk1Jf47f56v9vdtcZ/HS8JuWFQSIeiU1V1yeOb+Vs+8bEuoNauq01b7L667VSbvnLZb30= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4647wN38025747; Thu, 4 Jul 2024 08:20:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:subject:from:to:cc:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s=pp1; bh= fJKEiXXGW9feLm2g0VtmZNESgbRP/W+4AjqalJRwqu8=; b=PAAYIfKCVjBOfF+R Q25Lc3YgOrpRWBCOnl4tTKrvfKSOEijXBNOj+wxrsIIDnJN+FLOL320uiNyLc1kB cO4yJNFTICnGMocMOd0PXb7oInD5LEgJ6nvLLypE+NppeIRrzpizn2/Kz/Dru/eK T4pMPFvJ6+BpdW4gNJn83uHwMHgYPLrMOhd7LzRsOEV4RWbfLgsNG3otyXZ5hEKD yv7zEtj53zNJ9ebKcSwd2xar8UOsqv9qTj6cSTGQSteb1n1wLzSZdOllRAuzG0/9 0h93vOTGCmqSEwlHi1tgkk6XjzxCWBQ8PwhzMwaltWE0vr6a2nhTkCPI9YIchdLu QgqRZg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 405qtjg1yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:20:17 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4648KGK5028271; Thu, 4 Jul 2024 08:20:16 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 405qtjg1ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:20:16 +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 4645bf3G024085; Thu, 4 Jul 2024 08:20:15 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 402ya3pqus-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:20:15 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4648KBEN54395180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Jul 2024 08:20:13 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E2422004D; Thu, 4 Jul 2024 08:20:11 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1690320040; Thu, 4 Jul 2024 08:20:10 +0000 (GMT) Received: from [9.200.158.244] (unknown [9.200.158.244]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 4 Jul 2024 08:20:09 +0000 (GMT) Message-ID: <4db7560b-5195-8ae0-dfe9-bae0d1e17dc4@linux.ibm.com> Date: Thu, 4 Jul 2024 16:20:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: [PATCH 2/3 v2] rs6000: Make all 128 bit scalar FP modes have 128 bit precision [PR112993] Content-Language: en-US From: "Kewen.Lin" To: GCC Patches Cc: Segher Boessenkool , Peter Bergner , David Edelsohn References: In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: LosvB4pZCZd_XLHwWJTCWiSWIchjR19_ X-Proofpoint-GUID: -NLOZZbbmnQ1-ylXK_UnpKYgvWdtetZt X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040054 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 Hi, On rs6000, there are three 128 bit scalar floating point modes TFmode, IFmode and KFmode. With some historical reasons, we defines them with different mode precisions, that is KFmode 126, TFmode 127 and IFmode 128. But in fact all of them should have the same mode precision 128, this special setting has caused some issues like some unexpected failures mentioned in [1] and also made us have to introduce some workarounds, such as: the workaround in build_common_tree_nodes for KFmode 126, the workaround in range_compatible_p for same mode but different precision issue. This patch is to make these three 128 bit scalar floating point modes TFmode, IFmode and KFmode have 128 bit mode precision, and keep the order same as previous in order to make machine independent parts of the compiler not try to widen IFmode to TFmode. Besides, build_common_tree_nodes adopts the newly added hook mode_for_floating_type so we don't need to worry about unexpected mode for long double type node. In function convert_mode_scalar, it adopts sext_optab for same precision modes conversion if !DECIMAL_FLOAT_MODE_P, so we only need to support sext_optab for any possible conversion. Thus this patch removes some useless trunc optab supports, supplements one new sext_optab which calls the common handler rs6000_expand_float128_convert, unnames two define_insn_and_split to avoid conflicts and make them more clear. Considering the current implementation that there is no chance to have KF <-> IF conversion (since either of them would be TF already), it adds two dummy define_expands to assert this. Bootstrapped and regtested on x86_64-redhat-linux, powerpc64{,le}-linux-gnu (ibm128 long double default) and powerpc64le-linux-gnu (ieee128 long double default). Comparing to v1 [2], it makes use of new hook mode_for_floating_type and factors out the change on generic part of code to 1/3. I'm going to push this once the generic part 1/3 gets approved and no objection on this one. btw, two related patches on fortran[3] and ranger[4] have been approved. [1] https://inbox.sourceware.org/gcc-patches/ 718677e7-614d-7977-312d-05a75e1fd5b4@linux.ibm.com/ [2] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651017.html [3] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651018.html [4] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651019.html BR, Kewen ----- PR target/112993 gcc/ChangeLog: * config/rs6000/rs6000-modes.def (IFmode, KFmode, TFmode): Define with FLOAT_MODE instead of FRACTIONAL_FLOAT_MODE, don't use special precisions any more. (rs6000-modes.h): Remove include. * config/rs6000/rs6000-modes.h: Remove. * config/rs6000/rs6000.h (rs6000-modes.h): Remove include. * config/rs6000/t-rs6000: Remove rs6000-modes.h include. * config/rs6000/rs6000.cc (rs6000_option_override_internal): Replace all uses of FLOAT_PRECISION_TFmode with 128. (rs6000_c_mode_for_floating_type): Likewise. * config/rs6000/rs6000.md (define_expand trunciftf2): Remove. (define_expand truncifkf2): Remove. (define_expand trunckftf2): Remove. (define_expand trunctfif2): Remove. (define_expand expandtfkf2, expandtfif2): Merge to ... (define_expand expandtf2): ... this, new. (define_expand expandiftf2): Merge to ... (define_expand expandtf2): ... this, new. (define_expand expandiftf2): Update with assert. (define_expand expandkfif2): New. (define_insn_and_split extendkftf2): Rename to ... (define_insn_and_split *extendkftf2): ... this. (define_insn_and_split trunctfkf2): Rename to ... (define_insn_and_split *extendtfkf2): ... this. --- gcc/config/rs6000/rs6000-modes.def | 31 +++++-------- gcc/config/rs6000/rs6000-modes.h | 36 --------------- gcc/config/rs6000/rs6000.cc | 9 +--- gcc/config/rs6000/rs6000.h | 5 --- gcc/config/rs6000/rs6000.md | 72 ++++++++---------------------- gcc/config/rs6000/t-rs6000 | 1 - 6 files changed, 32 insertions(+), 122 deletions(-) delete mode 100644 gcc/config/rs6000/rs6000-modes.h -- 2.39.1 diff --git a/gcc/config/rs6000/rs6000-modes.def b/gcc/config/rs6000/rs6000-modes.def index 094b246c834..b69593c40a6 100644 --- a/gcc/config/rs6000/rs6000-modes.def +++ b/gcc/config/rs6000/rs6000-modes.def @@ -18,12 +18,11 @@ along with GCC; see the file COPYING3. If not see . */ -/* We order the 3 128-bit floating point types so that IFmode (IBM 128-bit - floating point) is the 128-bit floating point type with the highest - precision (128 bits). This so that machine independent parts of the - compiler do not try to widen IFmode to TFmode on ISA 3.0 (power9) that has - hardware support for IEEE 128-bit. We set TFmode (long double mode) in - between, and KFmode (explicit __float128) below it. +/* We order the 3 128-bit floating point type modes here as KFmode, TFmode and + IFmode, it is the same as the previous order, to make machine independent + parts of the compiler do not try to widen IFmode to TFmode on ISA 3.0 + (power9) that has hardware support for IEEE 128-bit. We set TFmode (long + double mode) in between, and KFmode (explicit __float128) below it. Previously, IFmode and KFmode were defined to be fractional modes and TFmode was the standard mode. Since IFmode does not define the normal arithmetic @@ -33,24 +32,18 @@ 128-bit is not strictly a super-set of IBM extended double and the conversion to/from IEEE 128-bit was a function call. - We now make IFmode the highest fractional mode, which means its values are - not considered for widening. Since we don't define insns for IFmode, the - IEEE 128-bit modes would not widen to IFmode. */ - -#ifndef RS6000_MODES_H -#include "config/rs6000/rs6000-modes.h" -#endif - -/* IBM 128-bit floating point. */ -FRACTIONAL_FLOAT_MODE (IF, FLOAT_PRECISION_IFmode, 16, ibm_extended_format); + We now place IFmode last, which means its values are not considered for + widening. Since we don't define insns for IFmode, the IEEE 128-bit modes + would not widen to IFmode. */ /* Explicit IEEE 128-bit floating point. */ -FRACTIONAL_FLOAT_MODE (KF, FLOAT_PRECISION_KFmode, 16, ieee_quad_format); - +FLOAT_MODE (KF, 16, ieee_quad_format); /* 128-bit floating point, either IBM 128-bit or IEEE 128-bit. This is adjusted in rs6000_option_override_internal to be the appropriate floating point type. */ -FRACTIONAL_FLOAT_MODE (TF, FLOAT_PRECISION_TFmode, 16, ieee_quad_format); +FLOAT_MODE (TF, 16, ieee_quad_format); +/* IBM 128-bit floating point. */ +FLOAT_MODE (IF, 16, ibm_extended_format); /* Add any extra modes needed to represent the condition code. diff --git a/gcc/config/rs6000/rs6000-modes.h b/gcc/config/rs6000/rs6000-modes.h deleted file mode 100644 index cf95330c265..00000000000 --- a/gcc/config/rs6000/rs6000-modes.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Definitions 128-bit floating point precisions used by PowerPC. - Copyright (C) 2018-2024 Free Software Foundation, Inc. - Contributed by Michael Meissner (meissner@linux.ibm.com) - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ - -/* We order the 3 128-bit floating point types so that IFmode (IBM 128-bit - floating point) is the 128-bit floating point type with the highest - precision (128 bits). This so that machine independent parts of the - compiler do not try to widen IFmode to TFmode on ISA 3.0 (power9) that has - hardware support for IEEE 128-bit. We set TFmode (long double mode) in - between, and KFmode (explicit __float128) below it. - - We won't encounter conversion from IEEE 128-bit to IBM 128-bit because we - don't have insns to support the IBM 128-bit aritmetic operations. */ - -#ifndef RS6000_MODES_H -#define RS6000_MODES_H 1 -#define FLOAT_PRECISION_IFmode 128 -#define FLOAT_PRECISION_TFmode 127 -#define FLOAT_PRECISION_KFmode 126 -#endif /* RS6000_MODES_H */ diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 58553ff66f4..4af1eeb3722 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -4099,7 +4099,7 @@ rs6000_option_override_internal (bool global_init_p) 128 into the precision used for TFmode. */ int default_long_double_size = (RS6000_DEFAULT_LONG_DOUBLE_SIZE == 64 ? 64 - : FLOAT_PRECISION_TFmode); + : 128); /* Set long double size before the IEEE 128-bit tests. */ if (!OPTION_SET_P (rs6000_long_double_type_size)) @@ -4111,10 +4111,6 @@ rs6000_option_override_internal (bool global_init_p) else rs6000_long_double_type_size = default_long_double_size; } - else if (rs6000_long_double_type_size == FLOAT_PRECISION_TFmode) - ; /* The option value can be seen when cl_target_option_restore is called. */ - else if (rs6000_long_double_type_size == 128) - rs6000_long_double_type_size = FLOAT_PRECISION_TFmode; /* Set -mabi=ieeelongdouble on some old targets. In the future, power server systems will also set long double to be IEEE 128-bit. AIX and Darwin @@ -24384,8 +24380,7 @@ static machine_mode rs6000_c_mode_for_floating_type (enum tree_index ti) { if (ti == TI_LONG_DOUBLE_TYPE) - return rs6000_long_double_type_size == FLOAT_PRECISION_TFmode ? TFmode - : DFmode; + return rs6000_long_double_type_size == 128 ? TFmode : DFmode; return default_mode_for_floating_type (ti); } diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 9211f91740a..8ea9ac1707e 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -30,11 +30,6 @@ #include "config/rs6000/rs6000-opts.h" #endif -/* 128-bit floating point precision values. */ -#ifndef RS6000_MODES_H -#include "config/rs6000/rs6000-modes.h" -#endif - /* Definitions for the object file format. These are set at compile-time. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index a5d20594789..91b4306593b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -9334,79 +9334,43 @@ (define_insn "*ieee_128bit_vsx_nabs2_internal" "xxlor %x0,%x1,%x2" [(set_attr "type" "veclogical")]) -;; Float128 conversion functions. These expand to library function calls. -;; We use expand to convert from IBM double double to IEEE 128-bit -;; and trunc for the opposite. -(define_expand "extendiftf2" +;; Float128 conversion functions. +;; If the conversion happens between IBM double double and +;; IEEE 128-bit, it expands to library function calls. +;; Generic code adopts sext_optab for same precision scalar +;; float modes conversion, so we just need to define extend. +(define_expand "extendtf2" [(set (match_operand:TF 0 "gpc_reg_operand") - (float_extend:TF (match_operand:IF 1 "gpc_reg_operand")))] + (float_extend:TF (match_operand:IFKF 1 "gpc_reg_operand")))] "TARGET_FLOAT128_TYPE" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; }) -(define_expand "extendifkf2" - [(set (match_operand:KF 0 "gpc_reg_operand") - (float_extend:KF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" -{ - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; -}) - -(define_expand "extendtfkf2" - [(set (match_operand:KF 0 "gpc_reg_operand") - (float_extend:KF (match_operand:TF 1 "gpc_reg_operand")))] +(define_expand "extendtf2" + [(set (match_operand:IFKF 0 "gpc_reg_operand") + (float_extend:IFKF (match_operand:TF 1 "gpc_reg_operand")))] "TARGET_FLOAT128_TYPE" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; }) -(define_expand "extendtfif2" - [(set (match_operand:IF 0 "gpc_reg_operand") - (float_extend:IF (match_operand:TF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" -{ - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; -}) - -(define_expand "trunciftf2" - [(set (match_operand:TF 0 "gpc_reg_operand") - (float_truncate:TF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" -{ - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; -}) - -(define_expand "truncifkf2" +(define_expand "extendifkf2" [(set (match_operand:KF 0 "gpc_reg_operand") - (float_truncate:KF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" -{ - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; -}) - -(define_expand "trunckftf2" - [(set (match_operand:TF 0 "gpc_reg_operand") - (float_truncate:TF (match_operand:KF 1 "gpc_reg_operand")))] + (float_extend:KF (match_operand:IF 1 "gpc_reg_operand")))] "TARGET_FLOAT128_TYPE" { - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; + gcc_assert (false); }) -(define_expand "trunctfif2" +(define_expand "extendkfif2" [(set (match_operand:IF 0 "gpc_reg_operand") - (float_truncate:IF (match_operand:TF 1 "gpc_reg_operand")))] + (float_extend:IF (match_operand:KF 1 "gpc_reg_operand")))] "TARGET_FLOAT128_TYPE" { - rs6000_expand_float128_convert (operands[0], operands[1], false); - DONE; + gcc_assert (false); }) (define_insn_and_split "*extendtf2_internal" @@ -15173,7 +15137,7 @@ (define_insn "extend2_hw" ;; Conversion between KFmode and TFmode if TFmode is ieee 128-bit floating ;; point is a simple copy. -(define_insn_and_split "extendkftf2" +(define_insn_and_split "*extendkftf2" [(set (match_operand:TF 0 "vsx_register_operand" "=wa,?wa") (float_extend:TF (match_operand:KF 1 "vsx_register_operand" "0,wa")))] "TARGET_FLOAT128_TYPE && TARGET_IEEEQUAD" @@ -15189,7 +15153,7 @@ (define_insn_and_split "extendkftf2" [(set_attr "type" "*,veclogical") (set_attr "length" "0,4")]) -(define_insn_and_split "trunctfkf2" +(define_insn_and_split "*extendtfkf2" [(set (match_operand:KF 0 "vsx_register_operand" "=wa,?wa") (float_extend:KF (match_operand:TF 1 "vsx_register_operand" "0,wa")))] "TARGET_FLOAT128_TYPE && TARGET_IEEEQUAD" diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000 index b3ce09d523b..155788de40a 100644 --- a/gcc/config/rs6000/t-rs6000 +++ b/gcc/config/rs6000/t-rs6000 @@ -19,7 +19,6 @@ # . TM_H += $(srcdir)/config/rs6000/rs6000-cpus.def -TM_H += $(srcdir)/config/rs6000/rs6000-modes.h PASSES_EXTRA += $(srcdir)/config/rs6000/rs6000-passes.def EXTRA_GTYPE_DEPS += rs6000-builtins.h From patchwork Thu Jul 4 08:26:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1956722 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=Wk78fCyl; 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 4WF8tF66Gkz1xqb for ; Thu, 4 Jul 2024 18:28:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0DD2E384A4AD for ; Thu, 4 Jul 2024 08:28:20 +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 1BCB73858288 for ; Thu, 4 Jul 2024 08:27:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BCB73858288 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 1BCB73858288 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=1720081633; cv=none; b=Qk0lunzwFiDq7Xkf0Kk1qGLd4bnvOnjFfVcjJ3jAjYQlUhZ41n1lNsNE4/h21n1fQ39TlUU3ZwS0Gnqb5wdy+vZFKmmsJK3UZO/3MVl6pHXhohcas11h6PDbgTY0bBfbyVeb0WJc3FpQ1kfYgkGXy9y0kvbg6IUxN26GUhmkVNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720081633; c=relaxed/simple; bh=sXJzReQmEQ9BPsEO0MqSu5e9z+trgz0hV/Q/DTTWquk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=TlarCUp0vJ4XrjnnK61wC6C+HCG7D+nn6sXQmwRzZWD8et8FUe6UFvi3L2IHWw8OtmBQdsvLwRjdFe9QBBym+uHL66NplhtaD7d2F0+XF2YmmuPL5qVY8PK3EZ5EvN259NQQ7bAGQ8WnpwR8RH5+oGYob8AYKMixToBJi4StJAY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4647SeGR025726; Thu, 4 Jul 2024 08:27:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:subject:from:to:cc:references :in-reply-to:content-type:content-transfer-encoding; s=pp1; bh=6 9DsayXzNk/3RcSRfDO8tOO7Iy6yGJLpvpGkhkkoHHw=; b=Wk78fCylD0MaB9ANE DcNJWKC//mTFHwK9yJN2JtnBtRD56OyhAuFzFa+nosRUQVrl38kv41Xt3iFzY/1P A5I1+RqQ4H5DhKYxT4TeszwvM5dZqJAwmfYC5ktvI0CTkSHq2GKGvLk1NcMm+o2e 5QSGzYJo3PjUhU6Un0z54pHU6r/ejtNfzzMzK4StOOiRjKAqU502PTIc3el2PZtd CiRaL6nkc3Eik2wVdi1//eFBE+osnpwbEeqOx8u4B6Tz65qLhAP9QY8LGNytlv3k zEemCAn9iCE7q+Ay/AUOblG6LL4VO6TWURmOMZv7fZU1kMt+RHOEDg5kyAp6Kmu0 94FXA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 405qch051v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:27:08 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4648R71B020421; Thu, 4 Jul 2024 08:27:08 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 405qch051p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:27:07 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4646smDm006164; Thu, 4 Jul 2024 08:27:07 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 402vkufd17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:27:07 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4648R1Db48431524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Jul 2024 08:27:03 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5A7720043; Thu, 4 Jul 2024 08:27:01 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 705AA20040; Thu, 4 Jul 2024 08:26:59 +0000 (GMT) Received: from [9.200.158.244] (unknown [9.200.158.244]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 4 Jul 2024 08:26:59 +0000 (GMT) Message-ID: Date: Thu, 4 Jul 2024 16:26:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: [PATCH 3/3] tree: Remove KFmode workaround [PR112993] Content-Language: en-US From: "Kewen.Lin" To: GCC Patches Cc: "Joseph S. Myers" , Richard Biener , Richard Sandiford , Jakub Jelinek , Segher Boessenkool , Peter Bergner References: In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: aWwQviuN-2tg-ovH5T0TisEtv7ldLMUr X-Proofpoint-GUID: jSjCd62g8qr6ammjO8JYg4cqujbLoV9W 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-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=906 malwarescore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040058 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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 Hi, The fix for PR112993 will make KFmode have 128 bit mode precision, we don't need this workaround to fix up the type precision any more, and just go with the mode precision. So this patch is to remove KFmode workaround. Bootstrapped and regtested on x86_64-redhat-linux, powerpc64{,le}-linux-gnu (ibm128 long double default) and powerpc64le-linux-gnu (ieee128 long double default). Is it OK for trunk if {1,2}/3 in this series get landed? BR, Kewen ----- PR target/112993 gcc/ChangeLog: * tree.cc (build_common_tree_nodes): Drop the workaround for rs6000 KFmode precision adjustment. --- gcc/tree.cc | 9 --------- 1 file changed, 9 deletions(-) -- 2.39.1 diff --git a/gcc/tree.cc b/gcc/tree.cc index f801712c9dd..f730981ec8b 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -9575,15 +9575,6 @@ build_common_tree_nodes (bool signed_char) if (!targetm.floatn_mode (n, extended).exists (&mode)) continue; int precision = GET_MODE_PRECISION (mode); - /* Work around the rs6000 KFmode having precision 113 not - 128. */ - const struct real_format *fmt = REAL_MODE_FORMAT (mode); - gcc_assert (fmt->b == 2 && fmt->emin + fmt->emax == 3); - int min_precision = fmt->p + ceil_log2 (fmt->emax - fmt->emin); - if (!extended) - gcc_assert (min_precision == n); - if (precision < min_precision) - precision = min_precision; FLOATN_NX_TYPE_NODE (i) = make_node (REAL_TYPE); TYPE_PRECISION (FLOATN_NX_TYPE_NODE (i)) = precision; layout_type (FLOATN_NX_TYPE_NODE (i));