From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 65BB83858291 for ; Mon, 13 Feb 2023 16:05:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65BB83858291 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-pl1-x62d.google.com with SMTP id z1so13943261plg.6 for ; Mon, 13 Feb 2023 08:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=Wcf4YMWNSw4fWF+6TPCvmdZ07igg08n0oNDNi2Ztctc=; b=McSEf/oQlkNQzHLXUEdqkVqbJ7HUS70eMGZeL3VBjYcm3en9uM3IBjSTC/+yOIzunQ JwPT0qvn6woNNLE2CDg0YmHZgrX2kzz0bfh9tGP+6iL87wtg5YrqAnuh4HZVpDhJCDFO X+V76/VF0QidYz8V2L1nvyWpR2wWQ3D36CkgEWiP1/BYYOHQIeGswgvuczDiaz8QAhgk aCgIZxhXxiTxq2B7hZEUXin3/322qUczlbBpQW5iUAXv09ZjunamjocoO3KnVUq1t4CW Ort+Ajp+bMnu6JueEIGGgSQXQoXZx5Soi+3iCDOUIEyksK3Dffy9PzZrRSFe5H6aLAxI k4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Wcf4YMWNSw4fWF+6TPCvmdZ07igg08n0oNDNi2Ztctc=; b=jo56R64fHdHbGs75TtbjEv5S6xRairhnTb8K86x9n5h9dauzNd9dNXr3oU37RdISLk et2YvRswBdYdXSBXNpmA6hRGD6KybTBIzluBa/TCfGoq2mpcvlQj0iOQ+Wf/LMXD7BOp GWJvR8zzoCxFICU6/pwEpFwSbtOt4ih6eoyn3OaGputls1B4ilJPpfLtf84/4NWeJPJt UMgCDtXEIwR4UM7BQxcwVDiK3AfnEdjzH9Rl3ODOq/xVe8lIVtID2vQzRHmEN8Yp7KJ+ rBCyvTckrES1R7B05OXXSGNgDj5PwYwMBY3EdCjKpWj9mGTolo2dl2zVfM3xvwvr4mLc Xqlw== X-Gm-Message-State: AO0yUKWmKdJN7ERLGY3FtJhz5nuI7ap2+ndVi3q6Hg5khwluxpAc7/oo LJvRxU6hwSE0a/AX7SEWARY= X-Google-Smtp-Source: AK7set/sq2PZJhLagYrMwmSOzkSZgwsxFlkepwqC4HPl3POAGJMgBYlS876vqdTQfZVu2r10mjM2gA== X-Received: by 2002:a17:903:18b:b0:19a:a815:2858 with SMTP id z11-20020a170903018b00b0019aa8152858mr2541024plg.51.1676304307069; Mon, 13 Feb 2023 08:05:07 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id v16-20020a17090331d000b00198f1de408csm8360263ple.268.2023.02.13.08.05.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Feb 2023 08:05:06 -0800 (PST) Message-ID: <67a16242-bc88-4ca1-b8b5-432fbafd0330@gmail.com> Date: Mon, 13 Feb 2023 09:05:05 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] tree-optimization/108724 - vectorized code getting piecewise expanded Content-Language: en-US To: Richard Biener Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: <20230210110247.514FA385B53C@sourceware.org> <5abeaa51-b37a-b1c3-ca55-ca5047e6fa8f@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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 2/13/23 07:51, Richard Biener wrote: > On Mon, 13 Feb 2023, Jeff Law wrote: > >> >> >> On 2/10/23 04:02, Richard Biener via Gcc-patches wrote: >>> This fixes an oversight to when removing the hard limits on using >>> generic vectors for the vectorizer to enable both SLP and BB >>> vectorization to use those. The vectorizer relies on vector lowering >>> to expand plus, minus and negate to bit operations but vector >>> lowering has a hard limit on the minimum number of elements per >>> work item. Vectorizer costs for the testcase at hand work out >>> to vectorize a loop with just two work items per vector and that >>> causes element wise expansion and spilling. >>> >>> The fix for now is to re-instantiate the hard limit, matching what >>> vector lowering does. For the future the way to go is to emit the >>> lowered sequence directly from the vectorizer instead. >>> >>> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? >>> >>> Thanks, >>> Richard. >>> >>> PR tree-optimization/108724 >>> * tree-vect-stmts.cc (vectorizable_operation): Avoid >>> using word_mode vectors when vector lowering will >>> decompose them to elementwise operations. >>> >>> * gcc.target/i386/pr108724.c: New testcase. >> OK. Though can't this be a problem with logicals too? Or is there something >> special about +- going on here? > > Logical ops do not cross lanes even when using scalar operations on GPRs. > For +- you have to compute the MSB separately to avoid spilling over to > the next vector lane. Oh, yes, makes perfect sense. jeff