From patchwork Thu Aug 18 21:39:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp539682pxh; Thu, 18 Aug 2022 14:40:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR6KvKDzvRkvnyJwitn8dQi8mZZf6+uVfirv2EUXwnJhpE18FkHkEJIl780Ov5eGZ7a9VVIp X-Received: by 2002:a17:907:a044:b0:730:a18b:5b89 with SMTP id gz4-20020a170907a04400b00730a18b5b89mr3000428ejc.489.1660858817921; Thu, 18 Aug 2022 14:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660858817; cv=none; d=google.com; s=arc-20160816; b=V6CqFKX3g+YzUH2GFCEAM6CinUKzSyuYFCMj8eiE4aOAouVqrz2NeNQylSkvW0xMRw gZpvij9T5M+xuAZP1oxnfZ35qDB/UTc95w/JLDfSIOH6R3LMR4nGbgSzZ9hDdCF9jq9H lqYGwUSgQOEb+vvRjxlvNRYnHji2eN9syreQVAhgDeTR81F77FaE+paY6bVWhIY3yQGH B3ohBJcub2ilbpjSc535XZTwzwCxqA6DkS2VbwZ8MUdHthYlcfvqw080klmevZYPmiGf hkOxq8U7ibJ7QuxUszZCqwkDf5Fq4InZLrxqa1VGsyMpALvSIU8RhO+bsFVH8LwPStxg nEmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=g9Q2zCBsyS6CY770qIbXcYCljZkXxc1JcvJv4jTpzfY=; b=UnXGs9ZeTqlUoG6br+UT/fkS5IrDBooDru50kCWOtKfx2NpiHGS4eGp4q+TM9J4IpV KsuhpojqZSbqaVcqtkMtGAiHJvOTCuI9j2LLuZf3Ofm8nUo0HRGzQNvKqeJ0gZA/aIvJ Kfd2wm4HNmpZLmrBORZWi0zpt3gSV982++C8SfFVPIWH6S2dZVNfEelBOqsE7phw7T9d sOB6bJFRH5njHka4K5MZ6CLY3hSW2t5lkaY8FqGlYd3pO2d4WNYkHpNvsOl+x3g1joPG UXBo2yl0STsDUq21iC8Dy/CTcLlBADpR9spkKlfRET21csw8xFQ5XBqf3CHa9dgvdl+Z 54nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lxuGDW5O; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hc33-20020a17090716a100b00732f74db44dsi1964583ejc.17.2022.08.18.14.40.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 14:40:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lxuGDW5O; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D8903858438 for ; Thu, 18 Aug 2022 21:40:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D8903858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660858816; bh=g9Q2zCBsyS6CY770qIbXcYCljZkXxc1JcvJv4jTpzfY=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lxuGDW5OL7RCksy06q91lI7GLNxc/YtfPS81uE8tiOQBYLYatTlFZqjIwRD0jyuW8 4akKbaZNc4grp/vzf2FDCT6EVepTO6vOWAQEGS5xAwMUJK3PEQTGtsbe4i+T/ZKV4J aBf7TPffin615bNOnOV7hGCm7GnYUBLlfcHQ3KXA= 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 2623E3858D39 for ; Thu, 18 Aug 2022 21:39:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2623E3858D39 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27ILT4BC006580; Thu, 18 Aug 2022 21:39:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1wcpg5am-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:39:30 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27ILTMtI006988; Thu, 18 Aug 2022 21:39:30 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1wcpg5a4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:39:30 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27ILTZva006902; Thu, 18 Aug 2022 21:39:29 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02dal.us.ibm.com with ESMTP id 3hx3kahch0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:39:29 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27ILdRpb13042292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Aug 2022 21:39:27 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EBE5136053; Thu, 18 Aug 2022 21:39:27 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02BF2136051; Thu, 18 Aug 2022 21:39:26 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.65.225.181]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS; Thu, 18 Aug 2022 21:39:26 +0000 (GMT) Date: Thu, 18 Aug 2022 17:39:25 -0400 To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt Subject: [PATCH 1/3] Allow __ibm128 even if IEEE 128-bit floating point is not supported. Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: SSjts-_TDvZm9sYVbYfOjBZfosYq6Lpv X-Proofpoint-ORIG-GUID: RinYLf8DWFg00I9gr0btiL6niW4A-DW6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_16,2022-08-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180077 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741536695919301480?= X-GMAIL-MSGID: =?utf-8?q?1741536695919301480?= Allow __ibm128 even if IEEE 128-bit floating point is not supported. This patch allows the use of the __ibm128 keyword on non-VSX systems. Originally, the __ibm128 keyword was only enabled when the IEEE 128-bit floating point is enabled. Sometime back in the GCC 12 development period, Segher asked that the __ibm128 keyword be allowed in older systems that don't support IEEE 128-bit. But at the time, stage 1 had closed for GCC 12, so I deferred doing this change until GCC 13. This patch allows __ibm128 to be used if either IEEE 128-bit is enabled or long double used the IBM 128-bit format. I have tested these patches on the following systems: 1) LE Power10 using --with-cpu=power10 --with-long-double-format=ieee 2) LE Power10 using --with-cpu=power9 --with-long-double-format=ibm 3) LE Power10 using --with-cpu=power8 --with-long-double-format=ibm 4) LE Power10 using --with-cpu=power10 --with-long-double-format=ibm 5) LE Power9 using --with-cpu=power9 --with-long-double-format=ibm 6) BE Power8 using --with-cpu=power8 --with-long-double-format=ibm 7) BE Power8 using --with-cpu=power5 --with-long-double-format=ibm There were no regressions in the build or in the tests. Can I check this patch into the trunk? Did we want to backport this to earlier GCC releases? 2022-08-17 Michael Meissner gcc/ * config/rs6000/rs6000-builtins.cc (rs6000_init_builtins): Enable using the__ibm128 keyword on systems that either use the 128-bit IBM long double format for long double or support IEEE 128-bit. * config/rs6000/rs6000.cc (rs6000_init_libfuncs): Create IBM 128-bit floating point support functions on systems that support the __ibm128 keyword. (rs6000_scalar_mode_supported_p): Likewise. * config/rs6000/rs6000.h (TARGET_IBM128): New macro. * config/rs6000/rs6000.md (@extenddf2_fprs): Allow IFmode to be converted even if long double is not 128-bits. (extenddf2_vsx): Likewise. (extendiftf2):Allow conversion on systems that support the __ibm128 keyword. (extendtfif2): Likewise. (trunciftf2): Likewise. (trunctfif2): Likewise. --- gcc/config/rs6000/rs6000-builtin.cc | 2 +- gcc/config/rs6000/rs6000.cc | 13 ++++++++----- gcc/config/rs6000/rs6000.h | 6 ++++++ gcc/config/rs6000/rs6000.md | 13 ++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index 12afa86854c..70680890415 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -713,7 +713,7 @@ rs6000_init_builtins (void) For IEEE 128-bit floating point, always create the type __ieee128. If the user used -mfloat128, rs6000-c.cc will create a define from __float128 to __ieee128. */ - if (TARGET_LONG_DOUBLE_128 && (!TARGET_IEEEQUAD || TARGET_FLOAT128_TYPE)) + if (TARGET_IBM128) { if (!TARGET_IEEEQUAD) ibm128_float_type_node = long_double_type_node; diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index df491bee2ea..39527ce9bbc 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -11115,10 +11115,11 @@ rs6000_init_libfuncs (void) { /* __float128 support. */ if (TARGET_FLOAT128_TYPE) - { - init_float128_ibm (IFmode); - init_float128_ieee (KFmode); - } + init_float128_ieee (KFmode); + + /* __ibm128 support. */ + if (TARGET_IBM128) + init_float128_ibm (IFmode); /* AIX/Darwin/64-bit Linux quad floating point routines. */ if (TARGET_LONG_DOUBLE_128) @@ -23752,7 +23753,9 @@ rs6000_scalar_mode_supported_p (scalar_mode mode) if (DECIMAL_FLOAT_MODE_P (mode)) return default_decimal_float_supported_p (); - else if (TARGET_FLOAT128_TYPE && (mode == KFmode || mode == IFmode)) + else if (TARGET_FLOAT128_TYPE && mode == KFmode) + return true; + else if (TARGET_IBM128 && mode == IFmode) return true; else return default_scalar_mode_supported_p (mode); diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index ad9bf0f7358..813ec696c0d 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -564,6 +564,12 @@ extern int rs6000_vector_align[]; && TARGET_P8_VECTOR \ && TARGET_POWERPC64) +/* Whether the __ibm128 keyword is allowed. Any system that supports _Float128 + is assumed to be capable of supporting __ibm128. Similarly if the long + double size is 128 bits, we assume __ibm128 is supported. We don't want to + support it on a system without existing 128-bit long doubles. */ +#define TARGET_IBM128 (TARGET_FLOAT128_TYPE || TARGET_LONG_DOUBLE_128) + /* Inlining allows targets to define the meanings of bits in target_info field of ipa_fn_summary by itself, the used bits for rs6000 are listed below. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 1367a2cb779..f942597c3b4 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -8586,8 +8586,7 @@ (define_insn_and_split "@extenddf2_fprs" (float_extend:IBM128 (match_operand:DF 1 "nonimmediate_operand" "d,m,d"))) (use (match_operand:DF 2 "nonimmediate_operand" "m,m,d"))] - "!TARGET_VSX && TARGET_HARD_FLOAT - && TARGET_LONG_DOUBLE_128 && FLOAT128_IBM_P (mode)" + "!TARGET_VSX && TARGET_HARD_FLOAT && FLOAT128_IBM_P (mode)" "#" "&& reload_completed" [(set (match_dup 3) (match_dup 1)) @@ -8604,7 +8603,7 @@ (define_insn_and_split "@extenddf2_vsx" [(set (match_operand:IBM128 0 "gpc_reg_operand" "=d,d") (float_extend:IBM128 (match_operand:DF 1 "nonimmediate_operand" "wa,m")))] - "TARGET_LONG_DOUBLE_128 && TARGET_VSX && FLOAT128_IBM_P (mode)" + "TARGET_VSX && FLOAT128_IBM_P (mode)" "#" "&& reload_completed" [(set (match_dup 2) (match_dup 1)) @@ -9061,7 +9060,7 @@ (define_insn "*ieee_128bit_vsx_nabs2_internal" (define_expand "extendiftf2" [(set (match_operand:TF 0 "gpc_reg_operand") (float_extend:TF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9088,7 +9087,7 @@ (define_expand "extendtfkf2" (define_expand "extendtfif2" [(set (match_operand:IF 0 "gpc_reg_operand") (float_extend:IF (match_operand:TF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9097,7 +9096,7 @@ (define_expand "extendtfif2" (define_expand "trunciftf2" [(set (match_operand:TF 0 "gpc_reg_operand") (float_truncate:TF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9124,7 +9123,7 @@ (define_expand "trunckftf2" (define_expand "trunctfif2" [(set (match_operand:IF 0 "gpc_reg_operand") (float_truncate:IF (match_operand:TF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; From patchwork Thu Aug 18 21:41:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp540511pxh; Thu, 18 Aug 2022 14:42:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6XM29ogdCuHSNSAvOH8t6UrgfFmYwygAX4lkJmg7J16DUc0uMplMoLXJtu02YRrPQ7r1b3 X-Received: by 2002:a17:907:6818:b0:730:825d:7296 with SMTP id qz24-20020a170907681800b00730825d7296mr3114043ejc.21.1660858924329; Thu, 18 Aug 2022 14:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660858924; cv=none; d=google.com; s=arc-20160816; b=cOQVB0sdIx0eS5bLQxEamOzFLSGOt5HyOqoR9pwxhiPug7QYLOGmcKsTWfNPVVW4c0 8TGbKKB77fbbl0YecCVq82Fb9GHdTpih3Yr6nrWUzC679DFfKLCC97lvo9QJK/7//VCZ nvkaOsHAehkxARpwBKn2kGcPvMATnqPFR5m+EKdpU7Fx23MKjacA8B8Apd5gCBHYgIBo y/7oP1Fv5P4HSUd2wsxwP3ylunEyazA+nIhaPZ8VuCBVkrckcZFD6K8Atysfb6/bk2yE 9mcc84/uzkGy17/m4P3lIZ2T4hpscbGeGF9z680kJrcaQWuuEI+65LOXbsjZ8PGoKmDX pKXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=6XE9jyThy+PmxBATU3gMvbM/KMcmkSBr0ZS39dJu1Ec=; b=Dslb3uLBsNVmBXRyMgD4rrziV4JTe+vvlXBhnR4qbirL/Zs0VyXeSQ1//BV4Ox4gCx PzERojiNqMI7q6VhtZZIfgojE+VRA92kZWTaSj0oSNy2EVMsCuQ//sStXQ1Y1RY1idp2 eQf+KVk4VMtu57DvU94oDGI0iXChfIwP85/o+FSUs//zs06FY5yz9pcES7i8sddKHni4 jUcrFtWJXDxm3qVceeuP7hiZOP5pVqT/aEllTVuGJ21WPLFAsFUb/cMeLVNRn5xMr1VN 8uSfm5LiJ5wT5fbVH9DhkibkWpuq7/zQtI/b/DAvb5VHgEneO79sz5NORhJmIh6O4/3Z WpQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=htupPazK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ao9-20020a170907358900b0073133773ecasi1634787ejc.297.2022.08.18.14.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 14:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=htupPazK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 47E673858D28 for ; Thu, 18 Aug 2022 21:42:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47E673858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660858923; bh=6XE9jyThy+PmxBATU3gMvbM/KMcmkSBr0ZS39dJu1Ec=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=htupPazKl72dgRA8ridJ7Nz32BV6StiKOM5JkQMFZQ3/C8UXR73QteRx43KVlQDu4 MYAwEsrASX77Gb0eB7tsb3hGTTekhRBJW/VnJfrQcMTHHu7q+N5M87CgwmNsavtv4u pY1e0FDeBPlYw7eyab6h3ZIjS/yvNgZa/ca69oi0= 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 DBEC33858C83 for ; Thu, 18 Aug 2022 21:41:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DBEC33858C83 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27ILHMQb019182; Thu, 18 Aug 2022 21:41:20 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1w738qjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:41:19 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27ILUBZo015278; Thu, 18 Aug 2022 21:41:19 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1w738qhs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:41:19 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27ILKppX029765; Thu, 18 Aug 2022 21:41:18 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04wdc.us.ibm.com with ESMTP id 3hx3ka18af-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:41:18 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27ILfH8g45089154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Aug 2022 21:41:17 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 196F1BE04F; Thu, 18 Aug 2022 21:41:17 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A38ABE054; Thu, 18 Aug 2022 21:41:16 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.65.225.181]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTPS; Thu, 18 Aug 2022 21:41:16 +0000 (GMT) Date: Thu, 18 Aug 2022 17:41:14 -0400 To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt Subject: [PATCH 2/3] Allow __ibm128 with -msoft-float (PR target/105334) Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4MoNhgTdvjujYMJW4jj13n9ShELEgkQZ X-Proofpoint-ORIG-GUID: aNUzID6dLoXj1bcqRdhzdoBCfaHTq5S9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_16,2022-08-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 mlxlogscore=884 lowpriorityscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 bulkscore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180077 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741536807399070891?= X-GMAIL-MSGID: =?utf-8?q?1741536807399070891?= Allow __ibm128 with -msoft-float (PR target/105334) This patch allows __ibm128 to be used on systems with software floating point enabled. Previously, we required hardware floating point to be enabled to use __ibm128 keyword and the __ibm128 built-in functions. This patch fixes PR target/105334. I have tested this patch on the following systems: 1) LE Power10 using --with-cpu=power10 --with-long-double-format=ieee 2) LE Power10 using --with-cpu=power9 --with-long-double-format=ibm 3) LE Power10 using --with-cpu=power8 --with-long-double-format=ibm 4) LE Power10 using --with-cpu=power10 --with-long-double-format=ibm 5) LE Power9 using --with-cpu=power9 --with-long-double-format=ibm 6) BE Power8 using --with-cpu=power8 --with-long-double-format=ibm 7) BE Power8 using --with-cpu=power5 --with-long-double-format=ibm There were no regressions in the build or in the tests. On the power10 with long double using the IEEE 128-bit format, pr105334.c now runs where it previously failed. Can I check this patch into the trunk? Did we want to backport this to earlier GCC releases? 2022-08-17 Michael Meissner gcc/ PR target/105334 * config/rs6000/rs6000.cc (init_float128_ibm): Do not require hardware floating point for the IBM 128-bit floating point comparison functions. * config/rs6000/rs6000.h (FLOAT128_IBM_P): Do not require hardware floating point to enable recognizing IBM 128-bit floating point modes. --- gcc/config/rs6000/rs6000.cc | 37 +++++++++++++++++-------------------- gcc/config/rs6000/rs6000.h | 2 +- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 39527ce9bbc..a6ec4c71ac0 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -10913,26 +10913,23 @@ init_float128_ibm (machine_mode mode) set_optab_libfunc (smul_optab, mode, "__gcc_qmul"); set_optab_libfunc (sdiv_optab, mode, "__gcc_qdiv"); - if (!TARGET_HARD_FLOAT) - { - set_optab_libfunc (neg_optab, mode, "__gcc_qneg"); - set_optab_libfunc (eq_optab, mode, "__gcc_qeq"); - set_optab_libfunc (ne_optab, mode, "__gcc_qne"); - set_optab_libfunc (gt_optab, mode, "__gcc_qgt"); - set_optab_libfunc (ge_optab, mode, "__gcc_qge"); - set_optab_libfunc (lt_optab, mode, "__gcc_qlt"); - set_optab_libfunc (le_optab, mode, "__gcc_qle"); - set_optab_libfunc (unord_optab, mode, "__gcc_qunord"); - - set_conv_libfunc (sext_optab, mode, SFmode, "__gcc_stoq"); - set_conv_libfunc (sext_optab, mode, DFmode, "__gcc_dtoq"); - set_conv_libfunc (trunc_optab, SFmode, mode, "__gcc_qtos"); - set_conv_libfunc (trunc_optab, DFmode, mode, "__gcc_qtod"); - set_conv_libfunc (sfix_optab, SImode, mode, "__gcc_qtoi"); - set_conv_libfunc (ufix_optab, SImode, mode, "__gcc_qtou"); - set_conv_libfunc (sfloat_optab, mode, SImode, "__gcc_itoq"); - set_conv_libfunc (ufloat_optab, mode, SImode, "__gcc_utoq"); - } + set_optab_libfunc (neg_optab, mode, "__gcc_qneg"); + set_optab_libfunc (eq_optab, mode, "__gcc_qeq"); + set_optab_libfunc (ne_optab, mode, "__gcc_qne"); + set_optab_libfunc (gt_optab, mode, "__gcc_qgt"); + set_optab_libfunc (ge_optab, mode, "__gcc_qge"); + set_optab_libfunc (lt_optab, mode, "__gcc_qlt"); + set_optab_libfunc (le_optab, mode, "__gcc_qle"); + set_optab_libfunc (unord_optab, mode, "__gcc_qunord"); + + set_conv_libfunc (sext_optab, mode, SFmode, "__gcc_stoq"); + set_conv_libfunc (sext_optab, mode, DFmode, "__gcc_dtoq"); + set_conv_libfunc (trunc_optab, SFmode, mode, "__gcc_qtos"); + set_conv_libfunc (trunc_optab, DFmode, mode, "__gcc_qtod"); + set_conv_libfunc (sfix_optab, SImode, mode, "__gcc_qtoi"); + set_conv_libfunc (ufix_optab, SImode, mode, "__gcc_qtou"); + set_conv_libfunc (sfloat_optab, mode, SImode, "__gcc_itoq"); + set_conv_libfunc (ufloat_optab, mode, SImode, "__gcc_utoq"); } else { diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 813ec696c0d..f58f5f3f355 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -337,7 +337,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define FLOAT128_IBM_P(MODE) \ ((!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128 \ && ((MODE) == TFmode || (MODE) == TCmode)) \ - || (TARGET_HARD_FLOAT && ((MODE) == IFmode || (MODE) == ICmode))) + || ((MODE) == IFmode || (MODE) == ICmode)) /* Helper macros to say whether a 128-bit floating point type can go in a single vector register, or whether it needs paired scalar values. */ From patchwork Thu Aug 18 21:42:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp541203pxh; Thu, 18 Aug 2022 14:43:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR40wGzHu4d1FLpCC23P5+YvzUYCNNd6L98t0e+bVsLBTWNke/O3w8aLLdNppQjyzL0hNEad X-Received: by 2002:a17:906:9bfa:b0:730:cd06:ba3f with SMTP id de58-20020a1709069bfa00b00730cd06ba3fmr3038067ejc.224.1660859019827; Thu, 18 Aug 2022 14:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660859019; cv=none; d=google.com; s=arc-20160816; b=q7UqUwVQpuX8AEyIvqGB8/f2+5fedBIGtDgJ+nsWosUppXWjbLeOrkB0fhMAH6P9nF h5rlcBo3IIoSlW4I6DaulpEEilWVxYUV/Yf4d4uk8vnxGAbAGBGDqURvFCQ9zUUnAM4F oWGJkInraBNm4HRsnD/QHTbJybEdJcGGsSGislKxSDZGRJSCZmUinMLeTSwKzI1DB34N wVKB8+7QJUHQt69wfC0Jxs1BFuFzdIJM2EGbibqBRKyfg/jXipSrSGmLPTn5csVod84u fVg2dc6RozJjGT5QxXcH834vxx+VMamBVlc21ILpADo1TYrY3cF7aHW4LblK6FuBPTyg 0cPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=pm/zQYKhy3uxwY6E6ZWZgNIfSJcCAxCkmHMitXipEko=; b=tK2rS5am+6W9NRtF+md9R9wziky4q4rnY+d29gHgH58akfsgmiMDf6P11MMAt4bj1j VUo1Ee0eSkXyBsLSNlUE8BE0inKIlLnsW/6gXVpJEysyjndMpKeVanKt8TJnGBp/zARa 9avXpTltv7tLHonbaWZHWJquYsKE6Sb9f/0UiUTLYVQtkRWnpx30N32rk1YXJYczWCEr 5bNgdYQm+us7kaD/b4rXeRkfv6i33JrTvnKS2Y4EUdB0GyFp3iLGTu18S331UTGZ46k7 +kGdZk4L7jDFBd/nkLpdWshJ0EvWF1ZI8FLdgB9tgy8eYUSn4YvVquIIjo/iK7Qf+rTT e+fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HDe0Oftj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l11-20020a056402254b00b0043c06c2cfdesi2178749edb.571.2022.08.18.14.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 14:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HDe0Oftj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0B2D3858C83 for ; Thu, 18 Aug 2022 21:43:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0B2D3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660859018; bh=pm/zQYKhy3uxwY6E6ZWZgNIfSJcCAxCkmHMitXipEko=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HDe0Oftjf7znyXbMcKIyaD5EYrDtJJ7+1+BC1y6um2lrPwS7L6EgY4Hqe6vC2DlL2 AHiSgZYTRlTGmnoaOLLuHAcXwzNQKiguJoAEmg78s80vGFvbvkdS/YvJemSP1lQoF8 hKzgb+C3Wxt4RF7QN0ZLWMRHDHdrUOdA84SHYHCY= 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 B35A43858D28 for ; Thu, 18 Aug 2022 21:42:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B35A43858D28 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27ILT1pi006506; Thu, 18 Aug 2022 21:42:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1wcpg8dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:42:54 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27ILaW7q032379; Thu, 18 Aug 2022 21:42:54 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j1wcpg8dg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:42:54 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27ILKmlZ029732; Thu, 18 Aug 2022 21:42:53 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma04wdc.us.ibm.com with ESMTP id 3hx3ka18fk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 21:42:53 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27ILgqRh18874778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Aug 2022 21:42:52 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 542242805A; Thu, 18 Aug 2022 21:42:52 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F93728058; Thu, 18 Aug 2022 21:42:52 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.65.225.181]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTPS; Thu, 18 Aug 2022 21:42:51 +0000 (GMT) Date: Thu, 18 Aug 2022 17:42:50 -0400 To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt Subject: [PATCH 3/3] Add 'w' suffix for __ibm128 constants Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ab3CIhra0vL_1PZyUwHsPd29AzLWT3-N X-Proofpoint-ORIG-GUID: R6azdIqTnPTq7RYEIYfDLVMy-6ZHtxC9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_16,2022-08-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180077 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741536907706938669?= X-GMAIL-MSGID: =?utf-8?q?1741536907706938669?= Add 'w' suffix for __ibm128 constants. In the documentation, we mention that 'w' or 'W' can be used as a suffix for __ibm128 constants. We never implemented this. This patch fixes that. In addition, the 'q' and 'Q' suffix were changed to use the mode used for the __float128 type, instead of knowing whether to use KFmode or TFmode explicitly. This will be used in a future patch where we change the mode used for __float128 on systems where long double is IEEE 128-bit. I have tested this patch on the following systems: 1) LE Power10 using --with-cpu=power10 --with-long-double-format=ieee 2) LE Power10 using --with-cpu=power9 --with-long-double-format=ibm 3) LE Power10 using --with-cpu=power8 --with-long-double-format=ibm 4) LE Power10 using --with-cpu=power10 --with-long-double-format=ibm 5) LE Power9 using --with-cpu=power9 --with-long-double-format=ibm 6) BE Power8 using --with-cpu=power8 --with-long-double-format=ibm 7) BE Power8 using --with-cpu=power5 --with-long-double-format=ibm There were no regressions in the build or in the tests. Can I check this patch into the trunk? Did we want to backport this to earlier GCC releases? 2022-08-17 Michael Meissner gcc/ * config/rs6000/rs6000.cc (rs6000_c_mode_for_suffix): Allow 'w' or 'W' for __ibm128 constants. gcc/testsuite/ * gcc.target/powerpc/ibm128-suffix.c: New test. --- gcc/config/rs6000/rs6000.cc | 25 ++++++++++--------- .../gcc.target/powerpc/ibm128-suffix.c | 13 ++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index a6ec4c71ac0..046c538c748 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -23845,22 +23845,23 @@ rs6000_floatn_mode (int n, bool extended) } -/* Target hook for c_mode_for_suffix. */ +/* Target hook for c_mode_for_suffix. We use TYPE_MODE to follow the mode used + for __float128 and __ibm128. + + Only two suffixes are allowed, 'q' and 'w'. The 'q' suffix is used for + float128 constants on both the x86 and PowerPC processors. Its use predates + the use of 'f128' for _Float128 constants, and existing code still uses it. + + The 'w' suffix was used on the x86 processors for their 80-bit long + double. We use it for __ibm128 constants. */ static machine_mode rs6000_c_mode_for_suffix (char suffix) { - if (TARGET_FLOAT128_TYPE) - { - if (suffix == 'q' || suffix == 'Q') - return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode; + if (TARGET_FLOAT128_TYPE && (suffix == 'q' || suffix == 'Q')) + return TYPE_MODE (ieee128_float_type_node); - /* At the moment, we are not defining a suffix for IBM extended double. - If/when the default for -mabi=ieeelongdouble is changed, and we want - to support __ibm128 constants in legacy library code, we may need to - re-evalaute this decision. Currently, c-lex.cc only supports 'w' and - 'q' as machine dependent suffixes. The x86_64 port uses 'w' for - __float80 constants. */ - } + if (TARGET_IBM128 && (suffix == 'w' || suffix == 'W')) + return TYPE_MODE (ibm128_float_type_node); return VOIDmode; } diff --git a/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c b/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c new file mode 100644 index 00000000000..ff619860409 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target longdouble128 } */ +/* { dg-options "-O2" } */ + +/* See if the 'w' suffix is accepted for __ibm128. */ +#ifndef NUMBER +#define NUMBER 123456789012345678901234567890123456789E-10 +#endif + +#define GLUE2(X,Y) X ## Y +#define GLUE(X,Y) GLUE2(X,Y) + +__ibm128 x = GLUE (NUMBER, w);