From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id BECF53858C74 for ; Mon, 13 Feb 2023 14:51:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BECF53858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7F2201F37F; Mon, 13 Feb 2023 14:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1676299896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+SzsM56CYLwbBcNJTw8xZ1ZkAoqFvKtqviuoVHLCaTo=; b=BBQo2CWVbU69mKMCN/LCzOqYKwy5SQrA7f9+9CZh9Zmq2Yar97T8GP33T/k7cvgG/iuBH6 OuIfSzebXG8Cl+Q1RdILHdcEcG45VSqeORgwnb0zpxGyaL9ChXkHkVolk/YbDg92P8Ecdo 5nqVXNmBTBqVzn7wQemSPbsMz6DB0GE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1676299896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+SzsM56CYLwbBcNJTw8xZ1ZkAoqFvKtqviuoVHLCaTo=; b=pWgdjCkyEHdvYkEb1bgTaaYFL+4JiikJaJVBNC5vq5kfV0UwPTg3uEE9UI1idqXQuAInBl rxOOpk0QmzRUrWCQ== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 54DCF2C141; Mon, 13 Feb 2023 14:51:36 +0000 (UTC) Date: Mon, 13 Feb 2023 14:51:36 +0000 (UTC) From: Richard Biener To: Jeff Law cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [PATCH] tree-optimization/108724 - vectorized code getting piecewise expanded In-Reply-To: <5abeaa51-b37a-b1c3-ca55-ca5047e6fa8f@gmail.com> Message-ID: References: <20230210110247.514FA385B53C@sourceware.org> <5abeaa51-b37a-b1c3-ca55-ca5047e6fa8f@gmail.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,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 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. Richard.