From patchwork Wed Jun 11 10:19:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Baylis X-Patchwork-Id: 31754 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 356552054B for ; Wed, 11 Jun 2014 10:21:05 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id us18sf24685696veb.2 for ; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:sender:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results; bh=iUU+KbmbhWSry3yH2G/2FVLUEuifF6UWsT9pBJy8Ims=; b=SrITxQFCMgJqqQMHSTf37V1bFkYb+5Uoiy6FikGpWgaVLc9vgoypJUfGiNtQhfeA0Q H2MjyTTe1Wuj65UUUOSMufU2KX6zoXS1JahKi7VpHTQ6bX0RpQhiZECxTcDga+lpLcu3 MCi6DRTvrKd7VqB+cSaiGF+2d7pJIXlL17I8uUWtujJhtCiSqn/TD6vAv+E2E7V1qE8U LPqE58e+43m/zZjqFY5aSk8vAD2qp5gzkfM1iMOi2bMnQb+4MH6W36Rm2sN5J4a/Gqfx l/BiCpUZnfanidf7l3irth/cm5RNaH7aPazQ/bqnqQCaplK6nzIZ/rEyS1B4dONPG5ZF rq1A== X-Gm-Message-State: ALoCoQnWqwRgAnaRqbFR5H31pEghdo3qgnjPji9KjCrK30jpSKy9H3rmL5NZZu+m2illt2h0lSgE X-Received: by 10.58.48.233 with SMTP id p9mr1211582ven.31.1402482064879; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.68 with SMTP id a62ls425384qge.79.gmail; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) X-Received: by 10.220.53.72 with SMTP id l8mr37853277vcg.16.1402482064772; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id v18si12826862vcu.0.2014.06.11.03.21.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 03:21:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22f as permitted sender) client-ip=2607:f8b0:400c:c01::22f; Received: by mail-ve0-f175.google.com with SMTP id us18so8289216veb.34 for ; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) X-Received: by 10.58.85.3 with SMTP id d3mr2181319vez.34.1402482064693; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp290931vcb; Wed, 11 Jun 2014 03:21:04 -0700 (PDT) X-Received: by 10.68.170.131 with SMTP id am3mr3919391pbc.97.1402482063851; Wed, 11 Jun 2014 03:21:03 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ee6si6129707pac.4.2014.06.11.03.21.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jun 2014 03:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-369985-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 28786 invoked by alias); 11 Jun 2014 10:20:34 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 28721 invoked by uid 89); 11 Jun 2014 10:20:34 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f173.google.com Received: from mail-we0-f173.google.com (HELO mail-we0-f173.google.com) (74.125.82.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 11 Jun 2014 10:20:33 +0000 Received: by mail-we0-f173.google.com with SMTP id t60so2052682wes.32 for ; Wed, 11 Jun 2014 03:20:29 -0700 (PDT) X-Received: by 10.194.82.9 with SMTP id e9mr48888533wjy.45.1402482029348; Wed, 11 Jun 2014 03:20:29 -0700 (PDT) Received: from sale.linaro.local ([213.122.173.130]) by mx.google.com with ESMTPSA id ej2sm33548768wjd.21.2014.06.11.03.20.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jun 2014 03:20:28 -0700 (PDT) From: Charles Baylis To: rearnsha@arm.com Cc: gcc-patches@gcc.gnu.org, Ramana.Radhakrishnan@arm.com Subject: [PATCH 3/9] Optimise __aeabi_uldivmod (stack manipulation) Date: Wed, 11 Jun 2014 11:19:49 +0100 Message-Id: <1402481995-12749-3-git-send-email-charles.baylis@linaro.org> In-Reply-To: <1402481995-12749-1-git-send-email-charles.baylis@linaro.org> References: <5398226C.5060905@arm.com> <1402481995-12749-1-git-send-email-charles.baylis@linaro.org> X-IsSubscribed: yes X-Original-Sender: charles.baylis@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22f as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 2014-05-22 Charles Baylis * config/arm/bpabi.S (__aeabi_uldivmod): Optimise stack pointer manipulation. --- libgcc/config/arm/bpabi.S | 54 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 11 deletions(-) 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 +/* we can use STRD/LDRD on v5TE and later, and any Thumb-2 architecture. */ +#if (defined(__ARM_EABI__) \ + && (defined(__thumb2__) \ + || (__ARM_ARCH >= 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 the + 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 /* 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 - 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)