From patchwork Mon Dec 12 11:29:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 704987 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 3tcgbz0v7Sz9t0v for ; Mon, 12 Dec 2016 22:29:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JCWA6jMz"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=R7LU8BLW51HzVi8i5 1nSntzrEe+tz/9cElF9ANcF56jxHz4ZDWLvkGaasm3mky/4hLXQbfR3v76LxPpBI jGDdzauQ+qaymAJvb2SjdiyRme6tVpK8KDAYCHt2FhbGpFaKMBxlfU8nhGCRGnMr W1t/StX3t7B+cd5vvhWHx/mIEE= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=lp0k2Yr0fkPVHtjCCC4zXZ8 WwKk=; b=JCWA6jMzyE6Bh7WzFlLNt00Y7/SSA+bFLTicqBzPBgD6BBwbKJt6Mp3 NYIIIlZWdXzPMetSBPZMj1T6g2gr87MchjBzfUBT5SFHO6gYTbQ6pX1z0EaEocC8 dD89VuceygmE9EkPb6XqF5TfDPTPEMJ1W30W3k3uc6dl7ypGzzOg= Received: (qmail 120358 invoked by alias); 12 Dec 2016 11:29:39 -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 120337 invoked by uid 89); 12 Dec 2016 11:29:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=31399, signs, Hx-languages-length:1840, ror X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Dec 2016 11:29:28 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 39.10 DYNA|AUTH) with ESMTPSA id v0b5f2sBCBTNl4c (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 12 Dec 2016 12:29:23 +0100 (CET) Subject: [patch,avr,committed] Minor tweak for 64-bit shifts. To: gcc-patches References: <20161210184549.1825.qmail@ns.sciencehorizons.net> Cc: George Spelvin , Denis Chertykov From: Georg-Johann Lay Message-ID: <7297ac19-4519-9a06-23e8-865d34433976@gjlay.de> Date: Mon, 12 Dec 2016 12:29:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161210184549.1825.qmail@ns.sciencehorizons.net> X-IsSubscribed: yes https://gcc.gnu.org/r243545 Applied this obvious tweak to trunk. Johann libgcc/ * config/avr/lib1funcs.S (__ashldi3): Use __tmp_reg__ to restore R16 instead of push + pop. (__ashrdi3, __lshrdi3): Same. And use __zero_reg__ for signs. Index: config/avr/lib1funcs.S =================================================================== --- config/avr/lib1funcs.S (revision 243542) +++ config/avr/lib1funcs.S (working copy) @@ -3113,20 +3113,22 @@ ENDF __bswapdi2 **********************************/ #if defined (L_ashrdi3) + +#define SS __zero_reg__ + ;; Arithmetic shift right ;; r25:r18 = ashr64 (r25:r18, r17:r16) DEFUN __ashrdi3 - bst r25, 7 - bld __zero_reg__, 0 + sbrc r25, 7 + neg SS ;; FALLTHRU ENDF __ashrdi3 ;; Logic shift right ;; r25:r18 = lshr64 (r25:r18, r17:r16) DEFUN __lshrdi3 - lsr __zero_reg__ - sbc __tmp_reg__, __tmp_reg__ - push r16 + ;; Signs are in SS (zero_reg) + mov __tmp_reg__, r16 0: cpi r16, 8 brlo 2f subi r16, 8 @@ -3137,9 +3139,9 @@ DEFUN __lshrdi3 mov r22, r23 mov r23, r24 mov r24, r25 - mov r25, __tmp_reg__ + mov r25, SS rjmp 0b -1: asr __tmp_reg__ +1: asr SS ror r25 ror r24 ror r23 @@ -3150,16 +3152,21 @@ DEFUN __lshrdi3 ror r18 2: dec r16 brpl 1b - pop r16 + clr __zero_reg__ + mov r16, __tmp_reg__ ret ENDF __lshrdi3 + +#undef SS + #endif /* defined (L_ashrdi3) */ #if defined (L_ashldi3) ;; Shift left ;; r25:r18 = ashl64 (r25:r18, r17:r16) +;; This function does not clobber T. DEFUN __ashldi3 - push r16 + mov __tmp_reg__, r16 0: cpi r16, 8 brlo 2f mov r25, r24 @@ -3182,13 +3189,13 @@ DEFUN __ashldi3 rol r25 2: dec r16 brpl 1b - pop r16 + mov r16, __tmp_reg__ ret ENDF __ashldi3 #endif /* defined (L_ashldi3) */ #if defined (L_rotldi3) -;; Shift left +;; Rotate left ;; r25:r18 = rotl64 (r25:r18, r17:r16) DEFUN __rotldi3 push r16