From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10207 invoked by alias); 18 Jun 2014 13:52:36 -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 10153 invoked by uid 89); 18 Jun 2014 13:52:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,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; Wed, 18 Jun 2014 13:52:33 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 18 Jun 2014 14:52:30 +0100 Received: from [10.1.208.33] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 18 Jun 2014 14:52:23 +0100 Message-ID: <53A1999D.4070104@arm.com> Date: Wed, 18 Jun 2014 13:52:00 -0000 From: Richard Earnshaw User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Charles Baylis CC: "gcc-patches@gcc.gnu.org" , Ramana Radhakrishnan Subject: Re: [PATCH 3/9] Optimise __aeabi_uldivmod (stack manipulation) References: <5398226C.5060905@arm.com> <1402481995-12749-1-git-send-email-charles.baylis@linaro.org> <1402481995-12749-3-git-send-email-charles.baylis@linaro.org> In-Reply-To: <1402481995-12749-3-git-send-email-charles.baylis@linaro.org> X-MC-Unique: 114061814523009501 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg01471.txt.bz2 On 11/06/14 11:19, Charles Baylis wrote: > 2014-05-22 Charles Baylis >=20 > * config/arm/bpabi.S (__aeabi_uldivmod): Optimise stack pointer > manipulation. OK. R. > --- > libgcc/config/arm/bpabi.S | 54 +++++++++++++++++++++++++++++++++++++----= ------ > 1 file changed, 43 insertions(+), 11 deletions(-) >=20 > diff --git a/libgcc/config/arm/bpabi.S b/libgcc/config/arm/bpabi.S > index ae76cd3..67246b0 100644 > --- a/libgcc/config/arm/bpabi.S > +++ b/libgcc/config/arm/bpabi.S > @@ -120,6 +120,46 @@ ARM_FUNC_START aeabi_ulcmp > #endif > .endm >=20=20 > +/* we can use STRD/LDRD on v5TE and later, and any Thumb-2 architecture.= */ > +#if (defined(__ARM_EABI__) \ > + && (defined(__thumb2__) \ > + || (__ARM_ARCH >=3D 5 && defined(__TARGET_FEATURE_DSP)))) > +#define CAN_USE_LDRD 1 > +#else > +#define CAN_USE_LDRD 0 > +#endif > + > +/* set up stack from for call to __udivmoddi4. At the end of the macro t= he > + stack is arranged as follows: > + sp+12 / space for remainder > + sp+8 \ (written by __udivmoddi4) > + sp+4 lr > + sp+0 sp+8 [rp (remainder pointer) argument for __udivmoddi4] > + > + */ > +.macro push_for_divide fname > +#if defined(__thumb2__) && CAN_USE_LDRD > + sub ip, sp, #8 > + strd ip, lr, [sp, #-16]! > +#else > + sub sp, sp, #8 > + do_push {sp, lr} > +#endif > +98: cfi_push 98b - \fname, 0xe, -0xc, 0x10 > +.endm > + > +/* restore stack */ > +.macro pop_for_divide > + ldr lr, [sp, #4] > +#if CAN_USE_LDRD > + ldrd r2, r3, [sp, #8] > + add sp, sp, #16 > +#else > + add sp, sp, #8 > + do_pop {r2, r3} > +#endif > +.endm > + > #ifdef L_aeabi_ldivmod >=20=20 > /* Perform 64 bit signed division. > @@ -165,18 +205,10 @@ ARM_FUNC_START aeabi_uldivmod > cfi_start __aeabi_uldivmod, LSYM(Lend_aeabi_uldivmod) > test_div_by_zero unsigned >=20=20 > - sub sp, sp, #8 > -#if defined(__thumb2__) > - mov ip, sp > - push {ip, lr} > -#else > - do_push {sp, lr} > -#endif > -98: cfi_push 98b - __aeabi_uldivmod, 0xe, -0xc, 0x10 > + push_for_divide __aeabi_uldivmod > + /* arguments in (r0:r1), (r2:r3) and *sp */ > bl SYM(__gnu_uldivmod_helper) __PLT__ > - ldr lr, [sp, #4] > - add sp, sp, #8 > - do_pop {r2, r3} > + pop_for_divide > RET > cfi_end LSYM(Lend_aeabi_uldivmod) >=20=20 >=20