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 DEBB93858416 for ; Fri, 22 Oct 2021 14:42:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DEBB93858416 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 959711FB; Fri, 22 Oct 2021 07:42:28 -0700 (PDT) Received: from localhost (unknown [10.32.98.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 044A83F694; Fri, 22 Oct 2021 07:42:27 -0700 (PDT) From: Richard Sandiford To: Jonathan Wright Mail-Followup-To: Jonathan Wright , "gcc-patches\@gcc.gnu.org" , Kyrylo Tkachov , richard.sandiford@arm.com Cc: "gcc-patches\@gcc.gnu.org" , Kyrylo Tkachov Subject: Re: [PATCH 3/6] gcc/expmed.c: Ensure vector modes are tieable before extraction References: Date: Fri, 22 Oct 2021 15:42:26 +0100 In-Reply-To: (Jonathan Wright's message of "Fri, 22 Oct 2021 15:33:21 +0100") 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=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, 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: Fri, 22 Oct 2021 14:42:30 -0000 Jonathan Wright writes: > Hi, > > Extracting a bitfield from a vector can be achieved by casting the > vector to a new type whose elements are the same size as the desired > bitfield, before generating a subreg. However, this is only an > optimization if the original vector can be accessed in the new > machine mode without first being copied - a condition denoted by the > TARGET_MODES_TIEABLE_P hook. > > This patch adds a check to make sure that the vector modes are > tieable before attempting to generate a subreg. This is a necessary > prerequisite for a subsequent patch that will introduce new machine > modes for Arm Neon vector-tuple types. > > Bootstrapped and regression tested on aarch64-none-linux-gnu and > x86_64-pc-linux-gnu - no issues. > > Ok for master? > > Thanks, > Jonathan > > --- > > gcc/ChangeLog: > > 2021-10-11 Jonathan Wright > > * expmed.c (extract_bit_field_1): Ensure modes are tieable. OK, thanks. Richard > diff --git a/gcc/expmed.c b/gcc/expmed.c > index 59734d4841cbd2056a7d5bda9134af79c8024c87..f58fb9d877d66809b39253ccdc803f0ecb009326 100644 > --- a/gcc/expmed.c > +++ b/gcc/expmed.c > @@ -1734,7 +1734,8 @@ extract_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, > FOR_EACH_MODE_FROM (new_mode, new_mode) > if (known_eq (GET_MODE_SIZE (new_mode), GET_MODE_SIZE (GET_MODE (op0))) > && known_eq (GET_MODE_UNIT_SIZE (new_mode), GET_MODE_SIZE (tmode)) > - && targetm.vector_mode_supported_p (new_mode)) > + && targetm.vector_mode_supported_p (new_mode) > + && targetm.modes_tieable_p (GET_MODE (op0), new_mode)) > break; > if (new_mode != VOIDmode) > op0 = gen_lowpart (new_mode, op0);