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 4805B385841B for ; Tue, 7 Dec 2021 11:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4805B385841B 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 EE90F11FB; Tue, 7 Dec 2021 03:29:36 -0800 (PST) Received: from [10.57.3.27] (unknown [10.57.3.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 69C9F3F73B; Tue, 7 Dec 2021 03:29:36 -0800 (PST) Message-ID: Date: Tue, 7 Dec 2021 11:29:41 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [AArch64] Enable generation of FRINTNZ instructions Content-Language: en-US To: Richard Biener Cc: Richard Sandiford , "gcc-patches@gcc.gnu.org" References: <8225375c-eb9e-f9b3-6bcd-9fbccf2fc87b@arm.com> <70s9nn94-452-5rrr-4458-q6n3qp563652@fhfr.qr> <36e3469a-3922-d49e-4006-0088eac29157@arm.com> <653o8886-3p5n-sr82-9n83-71q33o8824@fhfr.qr> <6c730f35-10b1-2843-cffc-4ed0851380be@arm.com> <85sr96q-o3s-602o-3436-40713n68pp84@fhfr.qr> <8d593d5f-41a0-6051-0ce0-d72834ecfa25@arm.com> From: "Andre Vieira (lists)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, 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: Tue, 07 Dec 2021 11:29:39 -0000 ping On 25/11/2021 13:53, Andre Vieira (lists) via Gcc-patches wrote: > > On 22/11/2021 11:41, Richard Biener wrote: >> >>> On 18/11/2021 11:05, Richard Biener wrote: >>>> This is a good shout and made me think about something I hadn't >>>> before... I >>>> thought I could handle the vector forms later, but the problem is >>>> if I add >>>> support for the scalar, it will stop the vectorizer. It seems >>>> vectorizable_call expects all arguments to have the same type, >>>> which doesn't >>>> work with passing the integer type as an operand work around. >> We already special case some IFNs there (masked load/store and gather) >> to ignore some args, so that would just add to this set. >> >> Richard. > Hi, > > Reworked it to add support of the new IFN to the vectorizer. Was > initially trying to make vectorizable_call and > vectorizable_internal_function handle IFNs with different inputs more > generically, using the information we have in the _direct structs > regarding what operands to get the modes from. Unfortunately, that > wasn't straightforward because of how vectorizable_call assumes > operands have the same type and uses the type of the DEF_STMT_INFO of > the non-constant operands (either output operand or non-constant > inputs) to determine the type of constants. I assume there is some > reason why we use the DEF_STMT_INFO and not always use > get_vectype_for_scalar_type on the argument types. That is why I ended > up with this sort of half-way mix of both, which still allows room to > add more IFNs that don't take inputs of the same type, but require > adding a bit of special casing similar to the IFN_FTRUNC_INT and > masking ones. > > Bootstrapped on aarch64-none-linux. > > OK for trunk? > > gcc/ChangeLog: > >         * config/aarch64/aarch64.md (ftrunc2): New > pattern. >         * config/aarch64/iterators.md (FRINTNZ): New iterator. >         (frintnz_mode): New int attribute. >         (VSFDF): Make iterator conditional. >         * internal-fn.def (FTRUNC_INT): New IFN. >         * internal-fn.c (ftrunc_int_direct): New define. >         (expand_ftrunc_int_optab_fn): New custom expander. >         (direct_ftrunc_int_optab_supported_p): New supported_p. >         * match.pd: Add to the existing TRUNC pattern match. >         * optabs.def (ftrunc_int): New entry. >         * stor-layout.h (element_precision): Moved from here... >         * tree.h (element_precision): ... to here. >         (element_type): New declaration. >         * tree.c (element_type): New function. >         (element_precision): Changed to use element_type. >         * tree-vect-stmts.c (vectorizable_internal_function): Add > support for >         IFNs with different input types. >         (vectorizable_call): Teach to handle IFN_FTRUNC_INT. >         * doc/md.texi: New entry for ftrunc pattern name. >         * doc/sourcebuild.texi (aarch64_frintzx_ok): New target. > > gcc/testsuite/ChangeLog: > >         * gcc.target/aarch64/merge_trunc1.c: Adapted to skip if > frintNz instruction available. >         * lib/target-supports.exp: Added arm_v8_5a_frintnzx_ok target. >         * gcc.target/aarch64/frintnz.c: New test. >         * gcc.target/aarch64/frintnz_vec.c: New test.