From patchwork Wed Jun 11 10:19:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Baylis X-Patchwork-Id: 31757 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F9FA2054B for ; Wed, 11 Jun 2014 10:21:42 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf11767075ykp.9 for ; Wed, 11 Jun 2014 03:21:42 -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=avBlXjqom3Gkwc/x7PbeAnF3QzP7Du+HVLXmBVoIvH4=; b=bdb9evBEUqejKXvwHWvYFoYxNqB+n5Wkk0XnLYEMZVyM3a+iQFGTzwlChtBHSsYLK/ WN+0aoeWVo5eZn6e3tyKpLmgJlGBNV04H4WTqJept4jrc8ruTdMlzz53qY4eGI+ZPl38 ES/iaKZJBCvDWyBMyn232v8ExUd7g8Bv0SY71fpBktPKagxkhcKXU3TEA7D79I3g6DUq OuUm7Q4v+yHOR1YPNx4O5CMZ6WbaHjVbc1IHMEkEM3vka4CI85IGe+7LXm6pVxLhc0FZ zRXTZVqLZjkkZdAgaAq5JbeTyz7DBf083mjWIGiW8IDDNdOcFLMpuHUdkRVb7JdG6wSF WB4A== X-Gm-Message-State: ALoCoQkdmtnIULN4XQdY+kbQkd9zz5H/HqW7vuP1mjvMo11G0bttKrhMejwDbAXBG9UtjyaMEOs4 X-Received: by 10.236.162.9 with SMTP id x9mr11110063yhk.17.1402482101981; Wed, 11 Jun 2014 03:21:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.33 with SMTP id e30ls2673784qge.89.gmail; Wed, 11 Jun 2014 03:21:41 -0700 (PDT) X-Received: by 10.52.92.5 with SMTP id ci5mr185528vdb.62.1402482101848; Wed, 11 Jun 2014 03:21:41 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id u5si2821656vcr.104.2014.06.11.03.21.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 03:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22e as permitted sender) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id us18so8267951veb.5 for ; Wed, 11 Jun 2014 03:21:41 -0700 (PDT) X-Received: by 10.53.12.229 with SMTP id et5mr2529222vdd.32.1402482101618; Wed, 11 Jun 2014 03:21:41 -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 vs6csp290965vcb; Wed, 11 Jun 2014 03:21:41 -0700 (PDT) X-Received: by 10.66.163.98 with SMTP id yh2mr12553969pab.104.1402482100713; Wed, 11 Jun 2014 03:21:40 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id sm10si6091483pab.134.2014.06.11.03.21.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jun 2014 03:21:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-369988-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 29116 invoked by alias); 11 Jun 2014 10:20:37 -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 28962 invoked by uid 89); 11 Jun 2014 10:20:36 -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-wi0-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 11 Jun 2014 10:20:35 +0000 Received: by mail-wi0-f176.google.com with SMTP id n3so5129285wiv.3 for ; Wed, 11 Jun 2014 03:20:32 -0700 (PDT) X-Received: by 10.180.90.145 with SMTP id bw17mr37946109wib.43.1402482032034; Wed, 11 Jun 2014 03:20:32 -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.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jun 2014 03:20:31 -0700 (PDT) From: Charles Baylis To: rearnsha@arm.com Cc: gcc-patches@gcc.gnu.org, Ramana.Radhakrishnan@arm.com Subject: [PATCH 6/9] Optimise __aeabi_ldivmod Date: Wed, 11 Jun 2014 11:19:52 +0100 Message-Id: <1402481995-12749-6-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::22e 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_ldivmod): Perform division using __udivmoddi4, and fixups for negative operands. --- libgcc/config/arm/bpabi.S | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/libgcc/config/arm/bpabi.S b/libgcc/config/arm/bpabi.S index 3f9ece5..c044167 100644 --- a/libgcc/config/arm/bpabi.S +++ b/libgcc/config/arm/bpabi.S @@ -175,10 +175,49 @@ ARM_FUNC_START aeabi_ldivmod test_div_by_zero signed push_for_divide __aeabi_ldivmod + cmp xxh, #0 + blt 1f + cmp yyh, #0 + blt 2f + /* arguments in (r0:r1), (r2:r3) and *sp */ + bl SYM(__udivmoddi4) __PLT__ + pop_for_divide + RET + +1: /* xxh:xxl is negative */ + negs xxl, xxl + sbc xxh, xxh, xxh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ + cmp yyh, #0 + blt 3f + /* arguments in (r0:r1), (r2:r3) and *sp */ + bl SYM(__udivmoddi4) __PLT__ + pop_for_divide + negs xxl, xxl + sbc xxh, xxh, xxh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ + negs yyl, yyl + sbc yyh, yyh, yyh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ + RET + +2: /* only yyh:yyl is negative */ + negs yyl, yyl + sbc yyh, yyh, yyh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ + /* arguments in (r0:r1), (r2:r3) and *sp */ + bl SYM(__udivmoddi4) __PLT__ + pop_for_divide + negs xxl, xxl + sbc xxh, xxh, xxh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ + RET + +3: /* both xxh:xxl and yyh:yyl are negative */ + negs yyl, yyl + sbc yyh, yyh, yyh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ /* arguments in (r0:r1), (r2:r3) and *sp */ - bl SYM(__gnu_ldivmod_helper) __PLT__ + bl SYM(__udivmoddi4) __PLT__ pop_for_divide + negs yyl, yyl + sbc yyh, yyh, yyh, lsl #1 /* Thumb-2 has no RSC, so use X - 2X */ RET + cfi_end LSYM(Lend_aeabi_ldivmod) #endif /* L_aeabi_ldivmod */