From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id BCBC3383582A for ; Mon, 2 Aug 2021 08:20:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCBC3383582A Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D194106F; Mon, 2 Aug 2021 01:20:09 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C0F783F719; Mon, 2 Aug 2021 01:20:08 -0700 (PDT) From: Richard Sandiford To: Richard Biener Mail-Followup-To: Richard Biener , gcc-patches@gcc.gnu.org, linkw@linux.ibm.com, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, linkw@linux.ibm.com Subject: Re: [PATCH] Add emulated gather capability to the vectorizer References: <3n590sn-6584-r9q-oqp7-953p556qp515@fhfr.qr> Date: Mon, 02 Aug 2021 09:20:07 +0100 In-Reply-To: (Richard Biener's message of "Mon, 2 Aug 2021 10:15:49 +0200 (CEST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 02 Aug 2021 08:20:11 -0000 Richard Biener writes: > On Mon, 2 Aug 2021, Richard Sandiford wrote: > >> Richard Biener writes: >> > On Fri, 30 Jul 2021, Richard Sandiford wrote: >> >> > @@ -9456,6 +9499,51 @@ vectorizable_load (vec_info *vinfo, >> >> > data_ref = NULL_TREE; >> >> > break; >> >> > } >> >> > + else if (memory_access_type == VMAT_GATHER_SCATTER) >> >> > + { >> >> > + /* Emulated gather-scatter. */ >> >> > + gcc_assert (!final_mask); >> >> >> >> For this to be safe, we need to make sure that >> >> check_load_store_for_partial_vectors clears >> >> LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P. Is that already guaranteed? >> >> (Maybe yes, I didn't look closely. :-)) >> > >> > I've made sure to fail earlier: >> > >> > @@ -8692,6 +8725,15 @@ vectorizable_load (vec_info *vinfo, >> > "unsupported access type for masked >> > load.\n"); >> > return false; >> > } >> > + else if (memory_access_type == VMAT_GATHER_SCATTER >> > + && gs_info.ifn == IFN_LAST >> > + && !gs_info.decl) >> > + { >> > + if (dump_enabled_p ()) >> > + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, >> > + "unsupported masked emulated gather.\n"); >> > + return false; >> > + } >> > } >> > >> > at least I don't see a way to emulate masked gathers ;) >> >> Yeah, that handles masked loads created by ifcvt. But we also need to >> protect against an unconditional load being converted into a predicated >> load for partial loop vectorisation. I think we still need a check in >> check_load_store_for_partial_vectors to handle that. The check wouldn't >> prevent vectorisation, it would just prevent using fully-predicated loops. > > But that seems to check for availability of the masked gather IFN which > of course isn't available and then sets > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P to false: Ah, yeah, OK. I wrongly thought that the relaxed check for gather/scatter support might have affected that too. Should be OK then. :-) Richard