From patchwork Wed Jul 13 11:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp204164eik; Wed, 13 Jul 2022 04:42:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vxK72xHut+1TiYU3CZf8tHA/E0KQNQ4Y+Dfg2vZnC2nByt1XMATil0dWxp+E4b0cnXYboC X-Received: by 2002:a17:906:8462:b0:72b:4e05:a8c1 with SMTP id hx2-20020a170906846200b0072b4e05a8c1mr3064122ejc.443.1657712537950; Wed, 13 Jul 2022 04:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657712537; cv=none; d=google.com; s=arc-20160816; b=uX5VN2bitikgnZ2VuK5wtWN/LOuWdGTzrcwFrKpW+sMwVuDElQw/DXsbK1IR8b4YVW RbE796bOtSSgwyPoEE+OiEgmKfAGzqC0g0XqnZ1hlRfSEmRTtST8O+6S8ih9NS9HMMZ5 gcLmSzizyx3scG2dlM8ZeTz9b1lyKxvfMP2XsHxTjW0TbLk9WBhczEZA4Aas4AADmQuq efpAQ+AEvJ8vvI9von7SnIhm/UlGNqKpdsU6RXe7KYDPaiGlwxuXLRs/u+Bcw9mkyvkI 1KUfYQVAO4gLQbUufla5HFKJcwHlTYf6qDynv8G0n12aZzc9/ZonI9gSe3OAR6jh/bTI 1ltQ== 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 :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=Gd/PpfVd1B91rlo6pZAI2VMph94WobJbbadp/4ZFmsQ=; b=tY2pVqU7v4DpnjeIwdY5JILFg3qJishepcRb/aI9LzqFmVJtxGocgCNJQsiLJop9GA uMWhX4t34sgpys6DzPWtSpabPIb/AndhPzHyr+vd+H9Pvi39+VAJUp1YiGuGstWwyG3p 6VxhxK2rAL1JyO7CiokGp7kTrWhhYUgv/Ym5+FD5r4R6jCx/UPFDh1iZ4YS8/gm3OM81 d2IWNVhYhkX7S+lRa53w4vRXCOdCtx5eDLgOdhy4GGEA7nr3pVL2uJ5kqyObeYxzbWyL gzBXwoXRF/DF96FrEACJQAg34lyErBcvQQ8+4wGOqluTWlhIpiNYG3gKKbiPpIKap+Ud mbBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lGl2uwD9; 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 h22-20020a056402281600b0043a77a6a338si22268403ede.400.2022.07.13.04.42.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 04:42: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=lGl2uwD9; 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 B9587385023D for ; Wed, 13 Jul 2022 11:42:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9587385023D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657712536; bh=Gd/PpfVd1B91rlo6pZAI2VMph94WobJbbadp/4ZFmsQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lGl2uwD9y/mRoRbRqpijH44/0i7sWclyHqYPFSYU2CTWoQ8ECOhRETSheXShiunCR kh/h8E+2wHsz0ZN5fOEIj/0Jsj/q9tR0KTjLhGGfn3OmYl/vxALkMN5Zl4BTkZAdak WWKxuWEl5lqfaGa+KgiTfSMlARDGxPYY3evhAooU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nh501-vm8.bullet.mail.kks.yahoo.co.jp (nh501-vm8.bullet.mail.kks.yahoo.co.jp [183.79.56.138]) by sourceware.org (Postfix) with SMTP id 566663857836 for ; Wed, 13 Jul 2022 11:41:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 566663857836 Received: from [183.79.100.140] by nh501.bullet.mail.kks.yahoo.co.jp with NNFMP; 13 Jul 2022 11:41:30 -0000 Received: from [183.79.101.123] by t503.bullet.mail.kks.yahoo.co.jp with NNFMP; 13 Jul 2022 11:41:30 -0000 Received: from [127.0.0.1] by omp510.mail.kks.yahoo.co.jp with NNFMP; 13 Jul 2022 11:41:30 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 825131.36726.bm@omp510.mail.kks.yahoo.co.jp Received: (qmail 81356 invoked by alias); 13 Jul 2022 11:41:30 -0000 Received: from unknown (HELO ?192.168.2.4?) (175.177.45.167 with ) by smtp5003.mail.kks.ynwp.yahoo.co.jp with SMTP; 13 Jul 2022 11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sY_HCZ..0nf2uc 3QZwVt2_V8VhYMmljywxVwNgwLWilamy2TWWaUyUrSmci9lYXZPRHIrH9RHU t7jgRZxYkJC2Pi1resw-- Message-ID: <4341501e-8903-baf9-f831-3328bb86907d@yahoo.co.jp> Date: Wed, 13 Jul 2022 20:40:13 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Content-Language: en-US To: GCC Patches Subject: [PATCH] xtensa: Minor fix for FP constant synthesis X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, 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: Takayuki 'January June' Suwa via Gcc-patches From: Takayuki 'January June' Suwa Reply-To: Takayuki 'January June' Suwa 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?1738237582307057594?= X-GMAIL-MSGID: =?utf-8?q?1738237582307057594?= This patch fixes an non-fatal issue about negative constant values derived from FP constant synthesis on hosts whose 'long' is wider than 'int32_t'. And also replaces the dedicated code in FP constant synthesis split pattern with the appropriate existing function call. gcc/ChangeLog: * config/xtensa/xtensa.md: In FP constant synthesis split pattern, subcontract to avoid_constant_pool_reference() as in the case of integer, because it can handle well too. And cast to int32_t before calling xtensa_constantsynth() in order to ignore upper 32-bit. gcc/testsuite/ChangeLog: * gcc.target/xtensa/constsynth_double.c: Modify in order to catch the issue. --- gcc/config/xtensa/xtensa.md | 35 +++++-------------- .../gcc.target/xtensa/constsynth_double.c | 2 +- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 9d998589631..6a58d3e2776 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1244,35 +1244,16 @@ "! optimize_debug && reload_completed" [(const_int 0)] { - int i = 0; - rtx x = XEXP (operands[1], 0); - long l[2]; - if (SYMBOL_REF_P (x) - && CONSTANT_POOL_ADDRESS_P (x)) - x = get_pool_constant (x); - else if (GET_CODE (x) == CONST) - { - x = XEXP (x, 0); - gcc_assert (GET_CODE (x) == PLUS - && SYMBOL_REF_P (XEXP (x, 0)) - && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)) - && CONST_INT_P (XEXP (x, 1))); - i = INTVAL (XEXP (x, 1)); - gcc_assert (i == 0 || i == 4); - i /= 4; - x = get_pool_constant (XEXP (x, 0)); - } - else - gcc_unreachable (); - if (GET_MODE (x) == SFmode) - REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (x), l[0]); - else if (GET_MODE (x) == DFmode) - REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (x), l); - else + rtx x = avoid_constant_pool_reference (operands[1]); + long l; + HOST_WIDE_INT value; + if (! CONST_DOUBLE_P (x) || GET_MODE (x) != SFmode) FAIL; + REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (x), l); x = gen_rtx_REG (SImode, REGNO (operands[0])); - if (! xtensa_constantsynth (x, l[i])) - emit_move_insn (x, GEN_INT (l[i])); + value = (int32_t)l; + if (! xtensa_constantsynth (x, value)) + emit_move_insn (x, GEN_INT (value)); DONE; }) diff --git a/gcc/testsuite/gcc.target/xtensa/constsynth_double.c b/gcc/testsuite/gcc.target/xtensa/constsynth_double.c index 890ca504780..5fba6a98650 100644 --- a/gcc/testsuite/gcc.target/xtensa/constsynth_double.c +++ b/gcc/testsuite/gcc.target/xtensa/constsynth_double.c @@ -5,7 +5,7 @@ void test(unsigned int count, double array[]) { unsigned int i; for (i = 0; i < count; ++i) - array[i] = 1.0; + array[i] = 8.988474246316506e+307; } /* { dg-final { scan-assembler-not "l32r" } } */