From patchwork Fri May 20 09:04:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 624425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rB27K4xLQz9t7P for ; Fri, 20 May 2016 19:04:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ISpMLoLy; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=oMWxA9GtaACf2Z8F+ b+2lIYVkwPeuuRpRdmJWFMZW46m5nePwuldSISjfSNesqfuob7g0XUw7mUoJ5GKM xRkBlDY1bAMCouN2ef0o6ir2VgTz3oyR/Lh0wNIxnJ2QXKxEvl8KsIZYA6T1QfZo t960pt2G76eD2S5F+pQhbcZ1fY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=LT1V/nZYg5DfmSSfwSg3lt6 vaqw=; b=ISpMLoLyKauQxx7xf5+FU8KZtb3dSoUj8k5zAZ3kPnz947KjiObiJzM RYJTWjxHXfHwvHO2YG5eldfuhowyTemrjIuAQufoqluo5xpM3UzA3tC9SQV/oeRC jSi7MxSDCROOos9BrXjoSD+l7CtTJz9Js0vs8q458dNMQRw2fVI8= Received: (qmail 107151 invoked by alias); 20 May 2016 09:04:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 107126 invoked by uid 89); 20 May 2016 09:04:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:3053, claims X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 May 2016 09:04:10 +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 6B9512F; Fri, 20 May 2016 02:04:27 -0700 (PDT) Received: from [10.2.206.43] (e100706-lin.cambridge.arm.com [10.2.206.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3020F3F218; Fri, 20 May 2016 02:04:07 -0700 (PDT) Message-ID: <573ED305.3060604@foss.arm.com> Date: Fri, 20 May 2016 10:04:05 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: James Greenhalgh CC: GCC Patches , Marcus Shawcroft , Richard Earnshaw Subject: Re: [PATCH][AArch64] PR target/70809: Delete aarch64_vmls pattern References: <573AF485.9080205@foss.arm.com> <20160517110438.GA8129@arm.com> In-Reply-To: <20160517110438.GA8129@arm.com> On 17/05/16 12:04, James Greenhalgh wrote: > On Tue, May 17, 2016 at 11:37:57AM +0100, Kyrill Tkachov wrote: >> Hi all, >> >> The aarch64_vmls pattern claims to perform a normal vector >> floating-point multiply-subtract but in fact performs a fused >> multiply-subtract. This is fine when -ffp-contract=fast, but it's not guarded >> on anything so will generate the FMLS instruction even when >> -ffp-contract=off. >> >> The solution is just to delete the pattern. If -ffp-contract=fast then an fma >> operation will have been generated and the fnma4 would be used to >> generate the FMLS instruction. >> >> Bootstrapped and tested on aarch64-none-linux-gnu. >> >> Ok for trunk and GCC 6 and 5? GCC 4.9 needs a different -mtune option in the >> testcase to trigger the testcase... > OK, thanks. > > Please consider the GCC 4.9 backport preapproved with whatever flag is > needed to expose the issue. Thanks. Here is the 4.9 backport. Committing there. Kyrill > Thanks, > James > >> Thanks, >> Kyrill >> >> 2016-05-17 Kyrylo Tkachov >> >> PR target/70809 >> * config/aarch64/aarch64-simd.md (aarch64_vmls): Delete. >> >> 2016-05-17 Kyrylo Tkachov >> >> PR target/70809 >> * gcc.target/aarch64/pr70809_1.c: New test. > diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 7626ed31fd688102ca81cd13a88e02891c971c99..9776816bfa7c7a174184bf8ddf90d73c88e40d2f 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1733,16 +1733,6 @@ (define_expand "vec_pack_trunc_df" } ) -(define_insn "aarch64_vmls" - [(set (match_operand:VDQF 0 "register_operand" "=w") - (minus:VDQF (match_operand:VDQF 1 "register_operand" "0") - (mult:VDQF (match_operand:VDQF 2 "register_operand" "w") - (match_operand:VDQF 3 "register_operand" "w"))))] - "TARGET_SIMD" - "fmls\\t%0., %2., %3." - [(set_attr "type" "neon_fp_mla__scalar")] -) - ;; FP Max/Min ;; Max/Min are introduced by idiom recognition by GCC's mid-end. An ;; expression like: diff --git a/gcc/testsuite/gcc.target/aarch64/pr70809_1.c b/gcc/testsuite/gcc.target/aarch64/pr70809_1.c new file mode 100644 index 0000000000000000000000000000000000000000..2e1bbf4b0902109f95949e9edbec9ec03fe40c78 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr70809_1.c @@ -0,0 +1,18 @@ +/* PR target/70809. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ffp-contract=off -mtune=generic" } */ + +/* Check that vector FMLS is not generated when contraction is disabled. */ + +void +foo (float *__restrict__ __attribute__ ((aligned (16))) a, + float *__restrict__ __attribute__ ((aligned (16))) x, + float *__restrict__ __attribute__ ((aligned (16))) y, + float *__restrict__ __attribute__ ((aligned (16))) z) +{ + unsigned i = 0; + for (i = 0; i < 256; i++) + a[i] = x[i] - (y[i] * z[i]); +} + +/* { dg-final { scan-assembler-not "fmls\tv.*" } } */