From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id D3D473858D1E for ; Fri, 4 Aug 2023 23:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3D473858D1E 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-pf1-x42c.google.com with SMTP id d2e1a72fcca58-686efb9ee0cso2408236b3a.3 for ; Fri, 04 Aug 2023 16:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691191960; x=1691796760; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ccfpgDAGHQHcqrOvo18hPfb1T4MLXe+wlnLa0ryK8Es=; b=C/u8Fry/iaHNRUSrICYaPMWix0VrOd+ForhqVzjfL3AQkaXgbWgMMhj83ePyV1REOf ziF7qAyJQIxdKmwXLhQ1FOpdl8+ozwcKj0PUMFUV9wdPlf4ZolhBSgMnYdeLL5SzAMbv TaMTSozf02yQ2i80amcqwWG2+yBXiSCM1IxL5APjXN5WwbC0nhcQGp/qQBuN+wntHD44 EFxrR1GrA8rz9R9QjK0eFvLPObbcivDPvYYfNalHQFGj41TzhJwojzzyM3RVj6/iPULw SOli+IOwBs8mWttxONbuXg61ImVCS/dpMXHhJ03KKkHWOmfSeoChtaEjHuv2zO6UTCS3 fNtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691191960; x=1691796760; h=content-transfer-encoding:in-reply-to:from:references:cc: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=ccfpgDAGHQHcqrOvo18hPfb1T4MLXe+wlnLa0ryK8Es=; b=ExgN1L4ZGV8WJ61WlPEFb7++lXOnwslKJxTIqs+2rLSvu1Kewc+SXuB5MtMt6WSpkf TvirpzwrkA2w4wYOah0E10sal8c+z94TJd9yPaRu3SmhrK238HOx2WqaKAPP5ITyZrlE be9isuf5GbKJ1AQGMDNePbCVPUPP1dG6yMhx/f+o7uxpNssz7qIdBZbIqXJ2VxH+n5/Y feNJXbm3T0vPuSa3Q5ZoNdZAm/bEIisXSYdan/k9U3Mlvr3+k/OWabsnpjfFyO0+OkN5 RMer+qYOmU+kQ9F/R2SWj3C7ySwE6tKbYCMIy4xzZTwDeK1BImaj9fLfXlovxomNE8eR Juwg== X-Gm-Message-State: AOJu0YzrZfUtDFN/By66pZOp9H+ESQey69dte9oVLWFCdN3DkALhEBGZ ELg7gpXmfBYJBzO+6Clshos= X-Google-Smtp-Source: AGHT+IEUwv4Wf3HYKjedxkqUt3y5gGMRv+Wso0HKL/sVelXPZIwLRAuB6kmuZ9poRo0JsB3ffsZ8xw== X-Received: by 2002:a05:6a00:b4a:b0:66a:48db:8f6a with SMTP id p10-20020a056a000b4a00b0066a48db8f6amr3987513pfo.12.1691191959653; Fri, 04 Aug 2023 16:32:39 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id c21-20020a62e815000000b0066f37665a6asm2039757pfi.117.2023.08.04.16.32.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 16:32:39 -0700 (PDT) Message-ID: <389f603d-ba15-ad1c-3c62-4ec34f9b545d@gmail.com> Date: Fri, 4 Aug 2023 17:32:37 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH-1, combine] Don't widen shift mode when target has rotate/mask instruction on original mode [PR93738] Content-Language: en-US To: HAO CHEN GUI , gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner References: <531959dd-1342-cbf1-054b-faf620907aea@linux.ibm.com> <514e6a6c-b357-f2ca-70ad-7af7cee6bfbe@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 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,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 List-Id: On 7/20/23 18:59, HAO CHEN GUI wrote: > Hi Jeff, > > 在 2023/7/21 5:27, Jeff Law 写道: >> Wouldn't it make more sense to just try rotate/mask in the original mode before trying a shift in a widened mode?  I'm not sure why we need a target hook here. > > There is no change to try rotate/mask with the original mode when > expensive_optimizations is set. The subst widens the shift mode. But we can add it before the attempt in the wider mode. > > if (flag_expensive_optimizations) > { > /* Pass pc_rtx so no substitutions are done, just > simplifications. */ > if (i1) > { > subst_low_luid = DF_INSN_LUID (i1); > i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0); > } > > subst_low_luid = DF_INSN_LUID (i2); > i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0); > } > > I don't know if the wider mode is helpful to other targets, so > I added the target hook. In this scenario we're often better off relying on rtx_costs (even with all its warts) rather than adding yet another target hook. I'd love to hear from Segher here to see if he's got other ideas. jeff