From patchwork Tue Aug 19 13:29:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 381357 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 DA1F2140096 for ; Tue, 19 Aug 2014 23:29:31 +1000 (EST) 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=Ts5AaFPdsNBjhO0MR XtVEYG1F+l2qNO6EIXSHgAfXbdDC6yu/JVhnaw3YcKihWL8rR2O7rqVCzCtncXUg pUCAJyYJH/mXrTPj90BjKbqHM2ZDTavYCL/hNVPHWzADZmXUVphh66MKH/R8ot3/ CI48wpc7lpaVKzwUeusFN8ZsmQ= 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=ligUH9kfKyq5BHItesC3HLW Qtt4=; b=sTWUDulpQAkQAxwiUWth4xHI+JdLLZKUV29ZAEsVPnFJjsRp3JmepSn P+SI2kgGnK1+5O46sfB39I/HbIGBoARc/QjPeY5Ac/V3QEgK066LbAXyLLTcNV8a CGDm9TnUN5klmTsSaS4GG3ASyyXtBDKOrU13R+e+MW0PFWA44xR4= Received: (qmail 1411 invoked by alias); 19 Aug 2014 13:29:18 -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 1402 invoked by uid 89); 19 Aug 2014 13:29:18 -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: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Aug 2014 13:29:16 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 19 Aug 2014 14:29:14 +0100 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Aug 2014 14:29:13 +0100 Message-ID: <53F35128.9010801@arm.com> Date: Tue, 19 Aug 2014 14:29:12 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Richard Henderson , GCC Patches CC: Richard Earnshaw , Marcus Shawcroft Subject: Re: [PATCH][AArch64] Use CC_Z and CC_NZ with csinc and similar instructions References: <53F1F068.4070708@arm.com> <53F24B7D.1010200@redhat.com> In-Reply-To: <53F24B7D.1010200@redhat.com> X-MC-Unique: 114081914291407901 X-IsSubscribed: yes On 18/08/14 19:52, Richard Henderson wrote: > On 08/18/2014 05:24 AM, Kyrill Tkachov wrote: >> -(define_insn "*csinc2_insn" >> +(define_insn "*csinc2__insn" >> [(set (match_operand:GPI 0 "register_operand" "=r") >> (plus:GPI (match_operator:GPI 2 "aarch64_comparison_operator" >> - [(match_operand:CC 3 "cc_register" "") (const_int 0)]) >> + [(match_operand:CC_ZERO 3 "cc_register" "") (const_int 0)]) > Rather than create 3 patterns that only vary in this mode, it would be better > to use (match_operand 3 "cc_register_zero"). Where the predicate is defined > with define_special_predicate so that you move the mode check inside the predicate. > Like this? I define in a similar way to cc_register, but add an extra ior for the CC_Z and CC_NZmode. Kyrill 2014-08-19 Kyrylo Tkachov * config/aarch64/predicates.md (cc_register_zero): New special predicate. * config/aarch64/aarch64.md (*csinc2_insn): Use cc_register_zero predicate instead of cc_register. (csinc3_insn): Likewise. (*csinv3_insn): Likewise. (*csneg3_insn): Likewise. > r~ > commit 6481f4befaadd67d4124e80db4514cf3fd9dbfa6 Author: Kyrylo Tkachov Date: Mon Aug 4 16:49:24 2014 +0100 [AArch64] Use CC_NZ in csinc pattern diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 3c51fd3..f172d56 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -2599,7 +2599,7 @@ (define_insn "aarch64_" (define_insn "*csinc2_insn" [(set (match_operand:GPI 0 "register_operand" "=r") (plus:GPI (match_operator:GPI 2 "aarch64_comparison_operator" - [(match_operand:CC 3 "cc_register" "") (const_int 0)]) + [(match_operand 3 "cc_register_zero" "") (const_int 0)]) (match_operand:GPI 1 "register_operand" "r")))] "" "csinc\\t%0, %1, %1, %M2" @@ -2610,7 +2610,7 @@ (define_insn "csinc3_insn" [(set (match_operand:GPI 0 "register_operand" "=r") (if_then_else:GPI (match_operator:GPI 1 "aarch64_comparison_operator" - [(match_operand:CC 2 "cc_register" "") (const_int 0)]) + [(match_operand 2 "cc_register_zero" "") (const_int 0)]) (plus:GPI (match_operand:GPI 3 "register_operand" "r") (const_int 1)) (match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))] @@ -2623,7 +2623,7 @@ (define_insn "*csinv3_insn" [(set (match_operand:GPI 0 "register_operand" "=r") (if_then_else:GPI (match_operator:GPI 1 "aarch64_comparison_operator" - [(match_operand:CC 2 "cc_register" "") (const_int 0)]) + [(match_operand 2 "cc_register_zero" "") (const_int 0)]) (not:GPI (match_operand:GPI 3 "register_operand" "r")) (match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))] "" @@ -2635,7 +2635,7 @@ (define_insn "*csneg3_insn" [(set (match_operand:GPI 0 "register_operand" "=r") (if_then_else:GPI (match_operator:GPI 1 "aarch64_comparison_operator" - [(match_operand:CC 2 "cc_register" "") (const_int 0)]) + [(match_operand 2 "cc_register_zero" "") (const_int 0)]) (neg:GPI (match_operand:GPI 3 "register_operand" "r")) (match_operand:GPI 4 "aarch64_reg_or_zero" "rZ")))] "" diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md index 3dd83ca..8c218df 100644 --- a/gcc/config/aarch64/predicates.md +++ b/gcc/config/aarch64/predicates.md @@ -26,6 +26,16 @@ (define_special_predicate "cc_register" && GET_MODE_CLASS (GET_MODE (op)) == MODE_CC")))) ) +(define_special_predicate "cc_register_zero" + (and (match_code "reg") + (and (match_test "REGNO (op) == CC_REGNUM") + (ior (match_test "mode == GET_MODE (op)") + (ior (match_test "mode == VOIDmode + && GET_MODE_CLASS (GET_MODE (op)) == MODE_CC") + (match_test "mode == CCmode || mode == CC_Zmode + || mode == CC_NZmode"))))) +) + (define_predicate "aarch64_call_insn_operand" (ior (match_code "symbol_ref") (match_operand 0 "register_operand")))