From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64352 invoked by alias); 1 May 2015 15:30:47 -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 64340 invoked by uid 89); 1 May 2015 15:30:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 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) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 May 2015 15:30:45 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-26.uk.mimecast.lan; Fri, 01 May 2015 16:30:42 +0100 Received: from [10.2.207.14] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 1 May 2015 16:30:42 +0100 Message-ID: <55439C22.2050105@arm.com> Date: Fri, 01 May 2015 15:30:00 -0000 From: Renlin Li User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Marcus Shawcroft CC: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH][AARCH64]Use mov for add with large immediate. References: <55367660.5080808@arm.com> In-Reply-To: X-MC-Unique: xy0jpi2ASFynkRXGp6dtNQ-1 Content-Type: multipart/mixed; boundary="------------030607000605010007020309" X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00067.txt.bz2 This is a multi-part message in MIME format. --------------030607000605010007020309 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 1130 Hi Marcus, On 01/05/15 11:19, Marcus Shawcroft wrote: > On 21 April 2015 at 17:10, Renlin Li wrote: >> Hi all, >> >> This is a simple patch to generate a move instruction to temporarily hold >> the large immediate for a add instruction. >> >> GCC regression test has been run using aarch64-none-elf toolchain. NO new >> issues. >> >> Okay for trunk? >> >> Regards, >> Renlin Li >> >> gcc/ChangeLog: >> >> 2015-04-21 Renlin Li >> >> * config/aarch64/aarch64.md (add3): Use mov when allowed. > A couple style nits: > > HOST_WIDE_INT imm =3D INTVAL (operands[2]); > - > - if (imm < 0) > > Don't remove the blank line between declarations and the first statement. > > + if (aarch64_move_imm (imm, mode) > + && can_create_pseudo_p ()) > + { > > The indentation of { should conform to the gnu style guide. > > It also looks to me that an unbroken line will fit within the 80 > column limit, hence the break before && is unnecessary. Thank you, Marcus. I have updated the patch accordingly, please check.. Regards, Renlin Li > > Cheers > /Marcus > --------------030607000605010007020309 Content-Type: text/x-patch; name=new-1.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="new-1.diff" Content-length: 1291 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 429c5ba..d0ceafa 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1414,18 +1414,28 @@ " if (! aarch64_plus_operand (operands[2], VOIDmode)) { - rtx subtarget =3D ((optimize && can_create_pseudo_p ()) - ? gen_reg_rtx (mode) : operands[0]); HOST_WIDE_INT imm =3D INTVAL (operands[2]); =20 - if (imm < 0) - imm =3D -(-imm & ~0xfff); + if (aarch64_move_imm (imm, mode) && can_create_pseudo_p ()) + { + rtx tmp =3D gen_reg_rtx (mode); + emit_move_insn (tmp, operands[2]); + operands[2] =3D tmp; + } else - imm &=3D ~0xfff; - - emit_insn (gen_add3 (subtarget, operands[1], GEN_INT (imm))); - operands[1] =3D subtarget; - operands[2] =3D GEN_INT (INTVAL (operands[2]) - imm); + { + rtx subtarget =3D ((optimize && can_create_pseudo_p ()) + ? gen_reg_rtx (mode) : operands[0]); + + if (imm < 0) + imm =3D -(-imm & ~0xfff); + else + imm &=3D ~0xfff; + + emit_insn (gen_add3 (subtarget, operands[1], GEN_INT (imm))); + operands[1] =3D subtarget; + operands[2] =3D GEN_INT (INTVAL (operands[2]) - imm); + } } " ) --------------030607000605010007020309--