From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by sourceware.org (Postfix) with ESMTPS id DAD133973049 for ; Fri, 15 Jan 2021 11:31:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DAD133973049 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=danielengel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu@danielengel.com Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id EA24AE07; Fri, 15 Jan 2021 06:31:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 15 Jan 2021 06:31:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=danielengel.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=0KhhwKgFOewm0 VJh6lImUMOxWZozsi/bMx5noPDLSyo=; b=EvxQ+hUd0H1/p78FcQ5sPnHRTG/La cWREywG5l+m/9jZjsXC5EwI4IhOt3X7zaVdSM/Y3gDvdeAociyrDVZRRi4/7pZPU teuvjfcc8N3n9tL3Vu0ZbuIkF849a05XJRMGETQBESZuuyYl/MWt6m/N1h2LFqxM dhF+DRpoqF3zvO/r6UXNi52VifEPMoDaHniFNtN5WNJvSNik8xeZTAiEqwWY5upN 8p3/Jvx0aZrwhDspS/q5QbyvXLCWdduExowu8kSVzo3S34qNU7iDx3eZY+8ppKOr 6u3+yY3mJ38dTsGmkcgP0HtI8fBOnV48gxHYpjlmdwFrcG7AcIsuw22tQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=0KhhwKgFOewm0VJh6lImUMOxWZozsi/bMx5noPDLSyo=; b=dDI705nX hMAu8ev4hgUHrn1lDwFPYYdeP0wIkI+BSycOtzAL1UVIz7YyVXXxdjECUSUDA8y5 LqYHgzGXDHLYpXnCwBod+yK6OOmLumYb7XGRAgqv7R5EujNpU6I/4N4VG1izNdcd YWXrcB/ym1kF+JyIwG6Ea1zGFYPE73nU0V1K3Ale17roTQ7sgTJZ+eLgEDuIdZf8 ntBJ30i+meQGt30RE4dF9RJ6sR03dKCK7QPKnEAjQvzQHKooXYU/FBZT0hnNcDVs WiePl6z//RF9kedw6tcCB3+V7OnmSNemvoN6nIbjSpPSH780xXHrBYwNjtjCzl3f BcOBK74H6xOLEg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtddvgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeffrghnihgvlhcugfhnghgvlhcuoehgnhhusegurghnihgvlhgv nhhgvghlrdgtohhmqeenucggtffrrghtthgvrhhnpeeiudegudeuhedtfefhgfeftdegff eijeetieeltefhgffgueelvefggeefvddvgeenucffohhmrghinheptghtiidvrdhssgdp ghhnuhdrohhrghdplhhisgdufhhunhgtshdrshgsnecukfhppeejuddrfeeirddutddtrd dvvddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep ghhnuhesuggrnhhivghlvghnghgvlhdrtghomh X-ME-Proxy: Received: from sendmail.lorien.danielengel.com (71-36-100-220.ptld.qwest.net [71.36.100.220]) by mail.messagingengine.com (Postfix) with ESMTPA id E5629108005B; Fri, 15 Jan 2021 06:31:17 -0500 (EST) 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 10FBVGD3023712; Fri, 15 Jan 2021 03:31:16 -0800 (PST) (envelope-from gnu@danielengel.com) From: Daniel Engel To: gcc-patches@gcc.gnu.org Cc: Richard.Earnshaw@foss.arm.com, christophe.lyon@linaro.org Subject: [PATCH v5 07/33] Refactor 'ctz' functions into a new file Date: Fri, 15 Jan 2021 03:30:35 -0800 Message-Id: <3a0975cb7141e46cf0cf20a6363422b775e726df.1610709584.git.gnu@danielengel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SCC_10_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Fri, 15 Jan 2021 11:31:21 -0000 This will make it easier to isolate changes in subsequent patches. gcc/libgcc/ChangeLog: 2021-01-13 Daniel Engel * config/arm/lib1funcs.S (__ctzsi2): Moved to ... * config/arm/ctz2.S: New file. --- libgcc/config/arm/ctz2.S | 86 +++++++++++++++++++++++++++++++++++ libgcc/config/arm/lib1funcs.S | 65 +------------------------- 2 files changed, 87 insertions(+), 64 deletions(-) create mode 100644 libgcc/config/arm/ctz2.S diff --git a/libgcc/config/arm/ctz2.S b/libgcc/config/arm/ctz2.S new file mode 100644 index 00000000000..8702c9afb94 --- /dev/null +++ b/libgcc/config/arm/ctz2.S @@ -0,0 +1,86 @@ +/* Copyright (C) 1995-2021 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_ctzsi2 +#ifdef NOT_ISA_TARGET_32BIT +FUNC_START ctzsi2 + negs r1, r0 + ands r0, r0, r1 + movs r1, #28 + movs r3, #1 + lsls r3, r3, #16 + cmp r0, r3 /* 0x10000 */ + bcc 2f + lsrs r0, r0, #16 + subs r1, r1, #16 +2: lsrs r3, r3, #8 + cmp r0, r3 /* #0x100 */ + bcc 2f + lsrs r0, r0, #8 + subs r1, r1, #8 +2: lsrs r3, r3, #4 + cmp r0, r3 /* #0x10 */ + bcc 2f + lsrs r0, r0, #4 + subs r1, r1, #4 +2: adr r2, 1f + ldrb r0, [r2, r0] + subs r0, r0, r1 + bx lr +.align 2 +1: +.byte 27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31 + FUNC_END ctzsi2 +#else +ARM_FUNC_START ctzsi2 + rsb r1, r0, #0 + and r0, r0, r1 +# if defined (__ARM_FEATURE_CLZ) + clz r0, r0 + rsb r0, r0, #31 + RET +# else + mov r1, #28 + cmp r0, #0x10000 + do_it cs, t + movcs r0, r0, lsr #16 + subcs r1, r1, #16 + cmp r0, #0x100 + do_it cs, t + movcs r0, r0, lsr #8 + subcs r1, r1, #8 + cmp r0, #0x10 + do_it cs, t + movcs r0, r0, lsr #4 + subcs r1, r1, #4 + adr r2, 1f + ldrb r0, [r2, r0] + sub r0, r0, r1 + RET +.align 2 +1: +.byte 27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31 +# endif /* !defined (__ARM_FEATURE_CLZ) */ + FUNC_END ctzsi2 +#endif +#endif /* L_clzsi2 */ + diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S index d92f73ba0c9..b1df00ac597 100644 --- a/libgcc/config/arm/lib1funcs.S +++ b/libgcc/config/arm/lib1funcs.S @@ -1804,70 +1804,7 @@ LSYM(Lover12): #endif /* __symbian__ */ #include "clz2.S" - -#ifdef L_ctzsi2 -#ifdef NOT_ISA_TARGET_32BIT -FUNC_START ctzsi2 - negs r1, r0 - ands r0, r0, r1 - movs r1, #28 - movs r3, #1 - lsls r3, r3, #16 - cmp r0, r3 /* 0x10000 */ - bcc 2f - lsrs r0, r0, #16 - subs r1, r1, #16 -2: lsrs r3, r3, #8 - cmp r0, r3 /* #0x100 */ - bcc 2f - lsrs r0, r0, #8 - subs r1, r1, #8 -2: lsrs r3, r3, #4 - cmp r0, r3 /* #0x10 */ - bcc 2f - lsrs r0, r0, #4 - subs r1, r1, #4 -2: adr r2, 1f - ldrb r0, [r2, r0] - subs r0, r0, r1 - bx lr -.align 2 -1: -.byte 27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31 - FUNC_END ctzsi2 -#else -ARM_FUNC_START ctzsi2 - rsb r1, r0, #0 - and r0, r0, r1 -# if defined (__ARM_FEATURE_CLZ) - clz r0, r0 - rsb r0, r0, #31 - RET -# else - mov r1, #28 - cmp r0, #0x10000 - do_it cs, t - movcs r0, r0, lsr #16 - subcs r1, r1, #16 - cmp r0, #0x100 - do_it cs, t - movcs r0, r0, lsr #8 - subcs r1, r1, #8 - cmp r0, #0x10 - do_it cs, t - movcs r0, r0, lsr #4 - subcs r1, r1, #4 - adr r2, 1f - ldrb r0, [r2, r0] - sub r0, r0, r1 - RET -.align 2 -1: -.byte 27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31 -# endif /* !defined (__ARM_FEATURE_CLZ) */ - FUNC_END ctzsi2 -#endif -#endif /* L_clzsi2 */ +#include "ctz2.S" /* ------------------------------------------------------------------------ */ /* These next two sections are here despite the fact that they contain Thumb -- 2.25.1