From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111997 invoked by alias); 13 Apr 2015 12:50:29 -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 111976 invoked by uid 89); 13 Apr 2015 12:50:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Apr 2015 12:50:27 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-17.uk.mimecast.lan; Mon, 13 Apr 2015 13:50:24 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 13 Apr 2015 13:50:24 +0100 Message-ID: <552BBB90.3040301@arm.com> Date: Mon, 13 Apr 2015 12:50:00 -0000 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: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw Subject: Re: [PATCH][ARM] Rewrite vc NEON patterns to use RTL operations rather than UNSPECs References: <54D20CB2.4070200@arm.com> In-Reply-To: <54D20CB2.4070200@arm.com> X-MC-Unique: xi1b1dEqRuilZf0kRdf9fg-1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00581.txt.bz2 Ping now that stage1 is open. https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00232.html Thanks, Kyrill On 04/02/15 12:12, Kyrill Tkachov wrote: > Hi all, > > This patch improves the vc patterns in neon.md to use proper RTL > operations rather than UNSPECS. > It is done in a similar way to the analogous aarch64 operations i.e. > vceq is expressed as > (neg (eq (...) (...))) > since we want to write all 1s to the result element when 'eq' holds and > 0s otherwise. > > The catch is that the floating-point comparisons can only be expanded to > the RTL codes when -funsafe-math-optimizations is given and they must > continue to use the UNSPECS otherwise. > For this I've created a define_expand that generates > the correct RTL depending on -funsafe-math-optimizations and two > define_insns to match the result: one using the RTL codes and one using > UNSPECs. > > I've also compressed some of the patterns together using iterators for > the [eq gt ge le lt] cases. > NOTE: for le and lt before this patch we would never generate > 'vclt. dm, dn, dp' instructions, only 'vclt. dm, dn, #0'. > With this patch we can now generate 'vclt. dm, dn, dp' assembly. > According to the ARM ARM this is just a pseudo-instruction that mapps to > vcgt with the operands swapped around. > I've confirmed that gas supports this code. > > The vcage and vcagt patterns are rewritten to use the form: > (neg > ( > (abs (...)) > (abs (...)))) > > and condensed together using iterators as well. > > Bootstrapped and tested on arm-none-linux-gnueabihf, made sure that the > advanced-simd-intrinsics testsuite is passing > (it did catch some bugs during development of this patch) and tried out > other NEON intrinsics codebases. > > The test gcc.target/arm/neon/pr51534.c now generates 'vclt. dn, > dm, #0' instructions where appropriate instead of the previous vmov of > #0 into a temp and then a 'vcgt. dn, temp, dm'. > I think that is correct behaviour since the test was trying to make sure > that we didn't generate a .u-typed comparison with #0, which is > what the PR was talking about (from what I can gather). > > What do people think of this approach? > I'm proposing this for next stage1, of course. > > Thanks, > Kyrill > > > 2015-02-04 Kyrylo Tkachov > > * config/arm/iterators.md (GTGE, GTUGEU, COMPARISONS): New code > iterators. > (cmp_op, cmp_type): New code attributes. > (NEON_VCMP, NEON_VACMP): New int iterators. > (cmp_op_unsp): New int attribute. > * config/arm/neon.md (neon_vc): New define_expand. > (neon_vceq): Delete. > (neon_vc_insn): New pattern. > (neon_vc_insn_unspec): Likewise. > (neon_vcgeu): Delete. > (neon_vcle): Likewise. > (neon_vclt: Likewise. > (neon_vcage): Likewise. > (neon_vcagt): Likewise. > (neon_vca): New define_expand. > (neon_vca_insn): New pattern. > (neon_vca_insn_unspec): Likewise. > > 2015-02-04 Kyrylo Tkachov > > * gcc.target/arm/neon/pr51534.c: Update vcg* scan-assembly patterns > to look for vcl* where appropriate.