From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 9929A3858D28 for ; Mon, 19 Jun 2023 13:54:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9929A3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-543c692db30so2879272a12.3 for ; Mon, 19 Jun 2023 06:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687182845; x=1689774845; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+EIcPfdWxhKxc7PlNhcBpnnqnDUReDN8KzJNVaLsAO0=; b=hzvGUukcvVr8QHWNS+Db+17jojNNYe9zK8IqVcw4F10/VNvFlblETdGZR1H/FMLLp9 aSs5EsDBzwaIHipfdg0iySzLik+dXJBfpCsvVB4gju6NU6hpCMOJqiB1oTijz8ACCmuL JxyRSTlVSGGdEBjrV6C6m1pbhLS5+RNbmTmxK5/eqTZS284T6u9JqOhMKcTTUbQ8kAR2 gQxMJPYTy/8T9J7jNoKIXSag0ADhKmPv8t5k290IcgapZqP2srsTgnPAPu9Gm2SWLSGX siOVLOTZCpI+34F3vAuGQOU07sItn30k0KXIijWGXB92XmpWXc5+Cf4LdgTTf4E4vzVR +LOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687182845; x=1689774845; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+EIcPfdWxhKxc7PlNhcBpnnqnDUReDN8KzJNVaLsAO0=; b=Mh4XIyCdSmDJ0IfTsRnmV3lNzC5SoZkQKi2lPNhGYAhgAfzuOqfBpogI6zUeWUH4y/ LecpWAfcZZlBsTxCw8zXzPFaspgJuTfux8CUGv4Rjzew9Y3bPCqyukgAwKqi33oSb3PH LCoPMr4rpbgzviR5L1Vk0d2UNEMTb5VFnmcaGoC7p03Ce0Gkd16mI70iIm3xCP/GKzAo 8DyayMdXRZTlojyHTZGPP1Ga/yjuzMPU+uIwAg/GjqbH0FHJtth5XEaTuFPi+6CJSIa8 s51IrvFZ6AzhKdIuoOs8C0v0mwt8XTXUNe6/5RGn0t4B8m7QsUu+c67l0GOH4aJ7q1Fh y3Vg== X-Gm-Message-State: AC+VfDycTPm/RVqtGHhDUjnXCm9EkW7GrNgilkcel0hpi9GJAkJVrGd3 h9SbQO7L2aoLJfVFvJQPdyptAj4AlMo= X-Google-Smtp-Source: ACHHUZ4dLx83twgYrTysuW8jFSVf9wEAAHpWEITx1EckKIlKNQRZf3l6bSSSZ+Z9eQbWBs3ZAW18PA== X-Received: by 2002:a17:903:280e:b0:1ac:5717:fd5 with SMTP id kp14-20020a170903280e00b001ac57170fd5mr9681271plb.60.1687182845539; Mon, 19 Jun 2023 06:54:05 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id m6-20020a170902db8600b001b3d8ac1b6bsm8228606pld.212.2023.06.19.06.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Jun 2023 06:54:05 -0700 (PDT) Message-ID: Date: Mon, 19 Jun 2023 07:54:03 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] Improved SUBREG simplifications in simplify-rtx.cc's simplify_subreg. Content-Language: en-US To: Roger Sayle , gcc-patches@gcc.gnu.org References: <008401d9a1ce$d46257d0$7d270770$@nextmovesoftware.com> From: Jeff Law In-Reply-To: <008401d9a1ce$d46257d0$7d270770$@nextmovesoftware.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SCC_BODY_URI_ONLY,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 6/18/23 04:22, Roger Sayle wrote: > > An x86 backend improvement that I'm working results in combine attempting > to recognize: > > (set (reg:DI 87 [ xD.2846 ]) > (ior:DI (subreg:DI (ashift:TI (zero_extend:TI (reg:DI 92)) > (const_int 64 [0x40])) 0) > (reg:DI 91))) > > where the lowpart SUBREG has difficulty seeing through the (hi<<64) > that the lowpart must be zero. Rather than workaround this in the > backend, the better fix is to teach simplify-rtx that > lowpart((hi<<64)|lo) -> lo and highpart((hi<<64)|lo) -> hi, so that > all backends benefit. Reducing the number of places where the > middle-end generates a SUBREG of something other than REG is a > good thing. > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=unix{-m32} > with no new failures, except for pr78904-1b.c, for which a backend > solution has just been proposed. Ok for mainline? > > > 2023-06-18 Roger Sayle > > gcc/ChangeLog > * simplify-rtx.cc (simplify_subreg): Optimize lowpart SUBREGs > of ASHIFT to const0_rtx with sufficiently large shift count. > Optimize highpart SUBREGs of ASHIFT as the shift operand when > the shift count is the correct offset. Optimize SUBREGs of > multi-word logic operations if the SUBREGs of both operands > can be simplified. OK Jeff