From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 8A00C3858C52 for ; Mon, 1 Aug 2022 13:16:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A00C3858C52 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id CF7B820807; Mon, 1 Aug 2022 13:16:57 +0000 (UTC) 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 B13A92C142; Mon, 1 Aug 2022 13:16:57 +0000 (UTC) Date: Mon, 1 Aug 2022 13:16:56 +0000 (UTC) From: Richard Biener To: "Andre Vieira (lists)" cc: Jakub Jelinek , Richard Sandiford , "gcc-patches@gcc.gnu.org" Subject: Re: [RFC] Teach vectorizer to deal with bitfield reads In-Reply-To: <69abe824-94f5-95b5-fb7f-6fa076973e05@arm.com> Message-ID: References: <4a6f2350-f070-1473-63a5-3232968d3a89@arm.com> <4ea91767-de43-9d30-5bd2-a9a0759760c7@arm.com> <69abe824-94f5-95b5-fb7f-6fa076973e05@arm.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.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 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-List-Received-Date: Mon, 01 Aug 2022 13:17:01 -0000 On Mon, 1 Aug 2022, Andre Vieira (lists) wrote: > > On 29/07/2022 11:52, Richard Biener wrote: > > On Fri, 29 Jul 2022, Jakub Jelinek wrote: > > > >> On Fri, Jul 29, 2022 at 09:57:29AM +0100, Andre Vieira (lists) via > >> Gcc-patches wrote: > >>> The 'only on the vectorized code path' remains the same though as > >>> vect_recog > >>> also only happens on the vectorized code path right? > >> if conversion (in some cases) duplicates a loop and guards one copy with > >> an ifn which resolves to true if that particular loop is vectorized and > >> false otherwise. So, then changes that shouldn't be done in case of > >> vectorization failure can be done on the for vectorizer only copy of the > >> loop. > > And just to mention, one issue with lowering of bitfield accesses > > is bitfield inserts which, on some architectures (hello m68k) have > > instructions operating on memory directly. For those it's difficult > > to not regress in code quality if a bitfield store becomes a > > read-modify-write cycle. That's one of the things holding this > > back. One idea would be to lower to .INSV directly for those targets > > (but presence of insv isn't necessarily indicating support for > > memory destinations). > > > > Richard. > Should I account for that when vectorizing though? From what I can tell (no > TARGET_VECTOR_* hooks implemented) m68k does not have vectorization support. No. > So the question is, are there currently any targets that vectorize and have > vector bitfield-insert/extract support? If they don't exist I suggest we worry > about it when it comes around, if not just for the fact that we wouldn't be > able to test it right now. > > If this is about not lowering on the non-vectorized path, see my previous > reply, I never intended to do that in the vectorizer. I just thought it was > the plan to do lowering eventually. Yes, for the vectorized path this all isn't an issue - and btw the advantage with if-conversion is that you get VN of the result "for free", the RMW cycle of bitfield stores likely have reads to share (and also redundant stores in the end, but ...). And yes, the plan was to do lowering generally. Just the simplistic approaches (my last one was a lowering pass somewhen after IPA, IIRC combined with SRA) run into some issues, like that on m68k, but IIRC also some others. So I wouldn't hold my breath, but then just somebody needs to do the work and think about how to deal with m68k and the likes... Richard.