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 9600D3858418 for ; Wed, 13 Jul 2022 08:30:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9600D3858418 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 B26AA1424; Wed, 13 Jul 2022 01:30:45 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD1B23F792; Wed, 13 Jul 2022 01:30:44 -0700 (PDT) From: Richard Sandiford To: Andrew Carlotti Mail-Followup-To: Andrew Carlotti , gcc-patches@gcc.gnu.org, Richard Biener , richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: [PATCH v2 2/2] aarch64: Lower vcombine to GIMPLE References: Date: Wed, 13 Jul 2022 09:30:43 +0100 In-Reply-To: (Andrew Carlotti's message of "Tue, 12 Jul 2022 15:43:29 +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=-54.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: Wed, 13 Jul 2022 08:30:47 -0000 Andrew Carlotti writes: > This lowers vcombine intrinsics to a GIMPLE vector constructor, which enables > better optimisation during GIMPLE passes. > > gcc/ > > * config/aarch64/aarch64-builtins.c > (aarch64_general_gimple_fold_builtin): Add combine. > > gcc/testsuite/ > > * gcc.target/aarch64/advsimd-intrinsics/combine.c: > New test. > > diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc > index 5753988a9964967c27a03aca5fddb9025fd8ed6e..a25756cfed5fab3a98ebf3e2ee29a5e117cbd2aa 100644 > --- a/gcc/config/aarch64/aarch64-builtins.cc > +++ b/gcc/config/aarch64/aarch64-builtins.cc > @@ -2857,6 +2857,28 @@ aarch64_general_gimple_fold_builtin (unsigned int fcode, gcall *stmt, > gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt)); > break; > > + BUILTIN_VDC (BINOP, combine, 0, AUTO_FP) > + BUILTIN_VD_I (BINOPU, combine, 0, NONE) > + BUILTIN_VDC_P (BINOPP, combine, 0, NONE) > + { > + tree first_part, second_part; > + if (BYTES_BIG_ENDIAN) > + { > + second_part = args[0]; > + first_part = args[1]; > + } > + else > + { > + first_part = args[0]; > + second_part = args[1]; > + } > + tree ret_type = TREE_TYPE (gimple_call_lhs (stmt)); Just repeating what we discussed off-list for the record: this needs to be gimple_call_return_type. LGTM with that change. Thanks, Richard > + tree ctor = build_constructor_va (ret_type, 2, NULL_TREE, first_part, > + NULL_TREE, second_part); > + new_stmt = gimple_build_assign (gimple_call_lhs (stmt), ctor); > + } > + break; > + > /*lower store and load neon builtins to gimple. */ > BUILTIN_VALL_F16 (LOAD1, ld1, 0, LOAD) > BUILTIN_VDQ_I (LOAD1_U, ld1, 0, LOAD) > diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/combine.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/combine.c > new file mode 100644 > index 0000000000000000000000000000000000000000..d08faf7a4a160a1e83428ed9b270731bbf7b8c8a > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/combine.c > @@ -0,0 +1,18 @@ > +/* { dg-do compile { target { aarch64*-*-* } } } */ > +/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */ > +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ > + > +#include > + > +/* > +** foo: > +** umov w0, v1\.s\[1\] > +** ret > +*/ > + > +int32_t foo (int32x2_t a, int32x2_t b) > +{ > + int32x4_t c = vcombine_s32(a, b); > + return vgetq_lane_s32(c, 3); > +} > +