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: 358591 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 4F628140081 for ; Wed, 11 Jun 2014 20:21:36 +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:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=lEJmBV/E3Dt6+WCDy49sYnS747XTccAN97xR8XSXMaiFsV4tMiD// OFY4GCEcJPSPetNd7119+/ePb9QOeTi70uk37fgYL7+p7t6pIvFxLOPZ0JXYXk2T 3jNlWdZfxrGNJ/JRhL/DdnUVGh/1SBAPDETOmmuY+H960B2TuZhHbw= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=pZ2Z2+Ky61UzMFN/k7kF+TVORF4=; b=Hu9n5qJE6bw6EPMjDmpl mp8sPyRCFt81mk8ujukRmtxNCdezuhCTk/iVxQn79ceap8aEnji1MfE+GABj9xbf MVt8CfXDMyMK0U1N0LVWfJrl05n930QBxrSJlvutlV7/Vc9sQLIkcf5SCEzPtssR SNEmXCj6KSgz/bTPrwo6txc= Received: (qmail 29116 invoked by alias); 11 Jun 2014 10:20:37 -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 28962 invoked by uid 89); 11 Jun 2014 10:20:36 -0000 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=avBlXjqom3Gkwc/x7PbeAnF3QzP7Du+HVLXmBVoIvH4=; b=gQb9Tezuhn0FY27li4dsHTL1xOuGElDeQcQ67f+KUfyobjbJnkmfnvxBIYuoJLr7Qa Hwip47WeMaX9meuk8moN5tTDzIrSqBMnXueiQPRBIbNFw3T918e3yP0osHuAo8ALIJ4Z IT+vN99zYyYK6qNd8vkR+8+x172uQKGmEYABO7EW18tPyEeL1NdS8P1iCZUcZ2fxESh7 hKMfhgGRKIgZf4rJvT7DVrDrio0dzIUVX7+3S3uRNH3wj7SZgFKkQxztfRhQSQUio3/c agVir+DqAPu81EOtCF+Pwbkfu8p/CHzPdc/SoInk6/XndhY2VU09px6eQvSIMugPOTW+ lduA== X-Gm-Message-State: ALoCoQlRw6ZSTxpHXH2Q45wlQiS3NlaRM2Fz9wjGXQ6r1DXKvtmG2+DbUqu1Apo3/IWVy+vNidKQ 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 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 */