From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3797 invoked by alias); 14 May 2019 08:08:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3786 invoked by uid 89); 14 May 2019 08:08:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT autolearn=no version=3.3.1 spammy=After X-HELO: foss.arm.com Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 08:08:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 52418374; Tue, 14 May 2019 01:08:31 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1563A3F71E; Tue, 14 May 2019 01:08:29 -0700 (PDT) From: Richard Sandiford To: Przemyslaw Wirkus Mail-Followup-To: Przemyslaw Wirkus ,nd , Richard Earnshaw , James Greenhalgh , Marcus Shawcroft , "gcc-patches\@gcc.gnu.org" , richard.sandiford@arm.com Cc: nd , Richard Earnshaw , James Greenhalgh , Marcus Shawcroft , "gcc-patches\@gcc.gnu.org" Subject: Re: [PATCH][GCC][AArch64] Vectorise __builtin_signbit on aarch64 References: Date: Tue, 14 May 2019 08:08:00 -0000 In-Reply-To: (Przemyslaw Wirkus's message of "Mon, 13 May 2019 11:53:37 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-05/txt/msg00668.txt.bz2 Przemyslaw Wirkus writes: > Hi all, > > Vectorise __builtin_signbit (v2sf, v4sf) with unsigned shift right vector > instruction. > > Bootstrapped and tested on aarch64-none-linux-gnu. > > Assembly output for: > $ aarch64-elf-gcc -S -O3 signbitv2sf.c -dp > > Before patch: > > foo: > ldp w2, w1, [x1] // 37 [c=0 l=4] *load_pair_zero_extendsidi2_aarch64/0 > and w2, w2, -2147483648 // 8 [c=4 l=4] andsi3/1 > and w1, w1, -2147483648 // 12 [c=4 l=4] andsi3/1 > stp w2, w1, [x0] // 38 [c=0 l=4] store_pair_sw_sisi/0 > ret // 32 [c=0 l=4] *do_return > > After patch: > > foo: > ldr d0, [x1] // 7 [c=8 l=4] *aarch64_simd_movv2sf/0 > ushr v0.2s, v0.2s, 31 // 8 [c=12 l=4] aarch64_simd_lshrv2si > str d0, [x0] // 9 [c=4 l=4] *aarch64_simd_movv2si/2 > ret // 28 [c=0 l=4] *do_return > > Assembly output for: > $ aarch64-elf-gcc -S -O3 signbitv4sf.c -dp > > Before patch: > > foo: > adrp x3, in // 38 [c=4 l=4] *movdi_aarch64/12 > adrp x2, out // 41 [c=4 l=4] *movdi_aarch64/12 > add x3, x3, :lo12:in // 40 [c=4 l=4] add_losym_di > add x2, x2, :lo12:out // 43 [c=4 l=4] add_losym_di > mov x0, 0 // 3 [c=4 l=4] *movdi_aarch64/3 > .p2align 3,,7 > .L2: > ldr w1, [x3, x0] // 10 [c=16 l=4] *zero_extendsidi2_aarch64/1 > and w1, w1, -2147483648 // 11 [c=4 l=4] andsi3/1 > str w1, [x2, x0] // 16 [c=4 l=4] *movsi_aarch64/8 > add x0, x0, 4 // 17 [c=4 l=4] *adddi3_aarch64/0 > cmp x0, 4096 // 19 [c=4 l=4] cmpdi/1 > bne .L2 // 20 [c=4 l=4] condjump > ret // 51 [c=0 l=4] \*do_return > > After patch: > > foo: > adrp x2, in // 37 [c=4 l=4] *movdi_aarch64/12 > adrp x1, out // 40 [c=4 l=4] *movdi_aarch64/12 > add x2, x2, :lo12:in // 39 [c=4 l=4] add_losym_di > add x1, x1, :lo12:out // 42 [c=4 l=4] add_losym_di > mov x0, 0 // 3 [c=4 l=4] *movdi_aarch64/3 > .p2align 3,,7 > .L2: > ldr q0, [x2, x0] // 10 [c=8 l=4] *aarch64_simd_movv4sf/0 > ushr v0.4s, v0.4s, 31 // 11 [c=12 l=4] aarch64_simd_lshrv4si > str q0, [x1, x0] // 15 [c=4 l=4] *aarch64_simd_movv4si/2 > add x0, x0, 16 // 16 [c=4 l=4] *adddi3_aarch64/0 > cmp x0, 4096 // 18 [c=4 l=4] cmpdi/1 > bne .L2 // 19 [c=4 l=4] condjump > ret // 50 [c=0 l=4] *do_return > > OK for Trunk ? > > Thanks, > Przemyslaw > > gcc/ChangeLog: > > 2019-05-13 Przemyslaw Wirkus > > * internal-fn.def (SIGNBIT): New. > * config/aarch64/aarch64-simd.md (signbitv2sf2): New expand > defined. > (signbitv4sf2): Likewise. > > gcc/testsuite/ChangeLog: > > 2019-05-13 Przemyslaw Wirkus > > * gcc.target/aarch64/signbitv4sf.c: New test. > * gcc.target/aarch64/signbitv2sf.c: New test. Thanks, applied as r271149. Richard