From patchwork Mon Oct 31 15:45:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Engel X-Patchwork-Id: 13301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2388203wru; Mon, 31 Oct 2022 08:51:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JluxcdmVXnzOp9woN/K1sd7t+5Ptxat+rsD5jzq/aeDGU5Zz86uhbEl0K8I4N0WF9w4Em X-Received: by 2002:a05:6402:194d:b0:461:8982:52b8 with SMTP id f13-20020a056402194d00b00461898252b8mr14221720edz.49.1667231518106; Mon, 31 Oct 2022 08:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667231518; cv=none; d=google.com; s=arc-20160816; b=eRABnVaMckmMCeX5fLYbo6dzpsen55oVbjjcPEM7DKweadp2YuqkJDuJIiOq1aiur2 SgXGz0PuLCJbOB76SrMXAKnnT17n/+IjKIYk6mG6VRTLaO+luURLbf4UvIfyql99Gx4H x0QQBejdsYHV8/MO08PjLEcy+g6QymZLt0FulPQap8aJ6/PpLbwe09lh4bVAS/8eee95 PhiyT9XNBfX66VeABo/uhNa66Xhzuy2eGN4BX15URgxH2vE539u3qZS9Cq9Z4j+uZRT8 MnfsQJdxmq3s5HeIkgGoICiDH7MsjaC9erUy3NAsqQCRfmhiRDat7T4J/bQlrdZSQ1s7 5K6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :feedback-id:dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=lt0pELubRSOPFzEnRpwkHqGaImwq+QxIgNDhPngg6TI=; b=wdDDkYxYLxn5VGJrnxcoVvwXfEsyWX3yrMZR/Slb9siw7nFBlPZcFkJQnR29aMLD4t QgjLdVfO0xmd8xrhoEX3xA15ImHKJU87GXYKt8+V8Gzkqg+oFq5n0Y9fk/DyRKDitSUz 1fNia0i5NPzpTgQo9zLpaC8+0Fgetg8F5egsHD91kO61fgrNSeDVQNFPxfLiEdPud9pF IK3StWZ5Apol6khSwBjZT/E/xgx0UfG+zvVLHCJjinE0JePukfz83BPcFfp1HVUPWl4E Z/2qMUd0EN+TzZq/LgnTKppG9U/u2Pru6Ytx5vvuy4UKZKC6uSr7x6BkcMJidCOxp2w8 S8pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@danielengel.com header.s=fm1 header.b=d3ZxtrWL; dkim=fail header.i=@messagingengine.com header.s=fm3 header.b=kIDcqaVG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s12-20020a1709067b8c00b0078e18bd3256si6638017ejo.291.2022.10.31.08.51.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 08:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@danielengel.com header.s=fm1 header.b=d3ZxtrWL; dkim=fail header.i=@messagingengine.com header.s=fm3 header.b=kIDcqaVG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 03389382A2C0 for ; Mon, 31 Oct 2022 15:48:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by sourceware.org (Postfix) with ESMTPS id AC8D73852763 for ; Mon, 31 Oct 2022 15:46:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC8D73852763 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=danielengel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=danielengel.com Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7EAF43200917; Mon, 31 Oct 2022 11:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 31 Oct 2022 11:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=danielengel.com; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1667231210; x= 1667317610; bh=lt0pELubRSOPFzEnRpwkHqGaImwq+QxIgNDhPngg6TI=; b=d 3ZxtrWL4uP6FJwl/r1xrmUtqkoqju2phZWAMjr/jvnQpktXBWmoyT+xdQNhOYEb8 9EOgOsdPAK+PYcXp5/i5FwdPua5cLIHNeWM7/+pFcLiech50egAWbu6tfXaOeWK+ QSZJwd7N1KPUzZR3Jm6xq/bInRxo+KT3ROsQbcVK3/IuwJczjTArnjhICBZo8gWz bmVh7GNUrsOSUrm+9PIJ1QYN1txaPRX7vRr08Fsm4G2BP2FLgOOjbZNNh71AOECR TNuK4feERZ439dS4repZacOhmnv465r9egS0VRQOKuel1g32CQkduTG7GLC0y4Tu 0HiQ9y3wkG0C0y2EuzQEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1667231210; x=1667317610; bh=lt0pELubRSOPF zEnRpwkHqGaImwq+QxIgNDhPngg6TI=; b=kIDcqaVG+yd/h4nAWLNQ3w2aLmrJD B7HzbGRDFVw4WcfOF1+c28Qole4avIKaS/W2eiiLQtYghvcOmf7tDnIPvIDDqPnT UVIz16VDrWtLIe2IFZpWXofrwZK6kpjD23a4JCIUT+sbtlAfxl3Rizb6bY2SrfWe zQvtzNFSQ6bu4txUXizp8hVZuqO5XT4DrRqUyieyzhqdUFZEYsXuGzi+6ziJ6r4M w973DVOd3QXIE/ZPtS10Rge9gSgfosmkCQpXdnFNDP0yAHeFVJs6lFORlonyiu24 89Gv0AhpihuK4uzuIcGR5UNjk3N0sq3qksiSiyRlnVuyEqHk7OKyBKAJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrudefgdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgv lhcugfhnghgvlhcuoehgnhhusegurghnihgvlhgvnhhgvghlrdgtohhmqeenucggtffrrg htthgvrhhnpedvleevueetiefglefgteekkeeftdekhfeileelffekfefhieettddtfefg gfevkeenucffohhmrghinheplhhshhhifhhtrdhssgdpghhnuhdrohhrghdplhhisgdufh hunhgtshdrshgsnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepghhnuhesuggrnhhivghlvghnghgvlhdrtghomh X-ME-Proxy: Feedback-ID: i791144d6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 31 Oct 2022 11:46:49 -0400 (EDT) Received: from ubuntu.lorien.danielengel.com (ubuntu.lorien.danielengel.com [10.0.0.96]) by sendmail.lorien.danielengel.com (8.15.2/8.15.2) with ESMTP id 29VFkewt087253; Mon, 31 Oct 2022 08:46:40 -0700 (PDT) (envelope-from gnu@danielengel.com) From: Daniel Engel To: Richard Earnshaw , gcc-patches@gcc.gnu.org Subject: [PATCH v7 08/34] Refactor 64-bit shift functions into a new file Date: Mon, 31 Oct 2022 08:45:03 -0700 Message-Id: <20221031154529.3627576-9-gnu@danielengel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031154529.3627576-1-gnu@danielengel.com> References: <20221031154529.3627576-1-gnu@danielengel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_LOW, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Engel , Christophe Lyon Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748218955975874890?= X-GMAIL-MSGID: =?utf-8?q?1748218955975874890?= This will make it easier to isolate changes in subsequent patches. gcc/libgcc/ChangeLog: 2022-10-09 Daniel Engel * config/arm/lib1funcs.S (__ashldi3, __ashrdi3, __lshldi3): Moved to ... * config/arm/eabi/lshift.S: New file. --- libgcc/config/arm/eabi/lshift.S | 123 ++++++++++++++++++++++++++++++++ libgcc/config/arm/lib1funcs.S | 103 +------------------------- 2 files changed, 124 insertions(+), 102 deletions(-) create mode 100644 libgcc/config/arm/eabi/lshift.S diff --git a/libgcc/config/arm/eabi/lshift.S b/libgcc/config/arm/eabi/lshift.S new file mode 100644 index 00000000000..6e79d96c118 --- /dev/null +++ b/libgcc/config/arm/eabi/lshift.S @@ -0,0 +1,123 @@ +/* Copyright (C) 1995-2022 Free Software Foundation, Inc. + +This file is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This file is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +#ifdef L_lshrdi3 + + FUNC_START lshrdi3 + FUNC_ALIAS aeabi_llsr lshrdi3 + +#ifdef __thumb__ + lsrs al, r2 + movs r3, ah + lsrs ah, r2 + mov ip, r3 + subs r2, #32 + lsrs r3, r2 + orrs al, r3 + negs r2, r2 + mov r3, ip + lsls r3, r2 + orrs al, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi al, al, lsr r2 + movpl al, ah, lsr r3 + orrmi al, al, ah, lsl ip + mov ah, ah, lsr r2 + RET +#endif + FUNC_END aeabi_llsr + FUNC_END lshrdi3 + +#endif + +#ifdef L_ashrdi3 + + FUNC_START ashrdi3 + FUNC_ALIAS aeabi_lasr ashrdi3 + +#ifdef __thumb__ + lsrs al, r2 + movs r3, ah + asrs ah, r2 + subs r2, #32 + @ If r2 is negative at this point the following step would OR + @ the sign bit into all of AL. That's not what we want... + bmi 1f + mov ip, r3 + asrs r3, r2 + orrs al, r3 + mov r3, ip +1: + negs r2, r2 + lsls r3, r2 + orrs al, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi al, al, lsr r2 + movpl al, ah, asr r3 + orrmi al, al, ah, lsl ip + mov ah, ah, asr r2 + RET +#endif + + FUNC_END aeabi_lasr + FUNC_END ashrdi3 + +#endif + +#ifdef L_ashldi3 + + FUNC_START ashldi3 + FUNC_ALIAS aeabi_llsl ashldi3 + +#ifdef __thumb__ + lsls ah, r2 + movs r3, al + lsls al, r2 + mov ip, r3 + subs r2, #32 + lsls r3, r2 + orrs ah, r3 + negs r2, r2 + mov r3, ip + lsrs r3, r2 + orrs ah, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi ah, ah, lsl r2 + movpl ah, al, lsl r3 + orrmi ah, ah, al, lsr ip + mov al, al, lsl r2 + RET +#endif + FUNC_END aeabi_llsl + FUNC_END ashldi3 + +#endif + diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S index 6cf7561835d..aa5957b8399 100644 --- a/libgcc/config/arm/lib1funcs.S +++ b/libgcc/config/arm/lib1funcs.S @@ -1699,108 +1699,7 @@ LSYM(Lover12): /* Prevent __aeabi double-word shifts from being produced on SymbianOS. */ #ifndef __symbian__ - -#ifdef L_lshrdi3 - - FUNC_START lshrdi3 - FUNC_ALIAS aeabi_llsr lshrdi3 - -#ifdef __thumb__ - lsrs al, r2 - movs r3, ah - lsrs ah, r2 - mov ip, r3 - subs r2, #32 - lsrs r3, r2 - orrs al, r3 - negs r2, r2 - mov r3, ip - lsls r3, r2 - orrs al, r3 - RET -#else - subs r3, r2, #32 - rsb ip, r2, #32 - movmi al, al, lsr r2 - movpl al, ah, lsr r3 - orrmi al, al, ah, lsl ip - mov ah, ah, lsr r2 - RET -#endif - FUNC_END aeabi_llsr - FUNC_END lshrdi3 - -#endif - -#ifdef L_ashrdi3 - - FUNC_START ashrdi3 - FUNC_ALIAS aeabi_lasr ashrdi3 - -#ifdef __thumb__ - lsrs al, r2 - movs r3, ah - asrs ah, r2 - subs r2, #32 - @ If r2 is negative at this point the following step would OR - @ the sign bit into all of AL. That's not what we want... - bmi 1f - mov ip, r3 - asrs r3, r2 - orrs al, r3 - mov r3, ip -1: - negs r2, r2 - lsls r3, r2 - orrs al, r3 - RET -#else - subs r3, r2, #32 - rsb ip, r2, #32 - movmi al, al, lsr r2 - movpl al, ah, asr r3 - orrmi al, al, ah, lsl ip - mov ah, ah, asr r2 - RET -#endif - - FUNC_END aeabi_lasr - FUNC_END ashrdi3 - -#endif - -#ifdef L_ashldi3 - - FUNC_START ashldi3 - FUNC_ALIAS aeabi_llsl ashldi3 - -#ifdef __thumb__ - lsls ah, r2 - movs r3, al - lsls al, r2 - mov ip, r3 - subs r2, #32 - lsls r3, r2 - orrs ah, r3 - negs r2, r2 - mov r3, ip - lsrs r3, r2 - orrs ah, r3 - RET -#else - subs r3, r2, #32 - rsb ip, r2, #32 - movmi ah, ah, lsl r2 - movpl ah, al, lsl r3 - orrmi ah, ah, al, lsr ip - mov al, al, lsl r2 - RET -#endif - FUNC_END aeabi_llsl - FUNC_END ashldi3 - -#endif - +#include "eabi/lshift.S" #endif /* __symbian__ */ #include "clz2.S"