Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2337160imm; Mon, 28 May 2018 06:18:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrdhg82rsTlKHY13wK12WdVreKkkxdnLccJTAhDBTesMSlGWJYj4i+TB42FKZmc37ySJe06 X-Received: by 2002:a65:6648:: with SMTP id z8-v6mr10299493pgv.397.1527513501566; Mon, 28 May 2018 06:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513501; cv=none; d=google.com; s=arc-20160816; b=C5aDtr8Msf7Im7ucvQ89RAgC1wXBzuzx54hS2brafPsuwEjvjWbZeLIEtxX80+CelJ Ar847eDYFOUrx9ywhHoXnYwsIBbjtvvp7fdLALw0yM+r0+oxoMBTSxY/AUeoiMZPu0uP 63NJV0kz2wDlU8Vg3d5rMIjpQDdSpRTwA60KFgU3WioJ1hP4jYH4sld8gQUpsFJazKc3 3gY5q9MgrQ203Hy3WrVr3OGUFadiE9P5mujDhmLQtoUSuVdOo5XJ49lDcc/27ti47CjO NziJKclpU0v6iN8bGoG0Paz070h4hGW3lBQkb7nnQi4Wlw7Pv6UTAgyCh+Kiyjpz4t70 VhjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:arc-authentication-results; bh=uIcfHV6jwG6zabnlEske4xQQVhIz12MDJbXv9x36mjw=; b=dcEv6jLmmBlJF5+FIKye9K1+Arj5oCOfqdXTcNNu2DSq9Egdvn3wRl+BHo7ZFW2xhO 64+HjG2mwIctGZ5u1oBtdl4TovOeDsdlju7kpde7Nvoj36eH9igTJy8m7N8YI8Lsj9tb GlhlPeQ4j5YNnSotnfHqF9N07NqWjD+6M2htt+DiMO44u0/AjcxKjQBb1tmimG1tupzE TeV/2xrr/u6cqFqiirT4M/nN74nyjsf3bz44siINLKu1o2Y4ITYwZhU8lDA3L7SIKQz4 Td3U99ANkPOGOje/t2QZ2C6hPu6+8Zu7cXncHIYQR2vHGf1FLjr+L5E6XJId8FWJqmlP Fw5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8-v6si12288106pll.58.2018.05.28.06.18.06; Mon, 28 May 2018 06:18:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165212AbeE1NR3 (ORCPT + 99 others); Mon, 28 May 2018 09:17:29 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:5433 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163597AbeE1KuD (ORCPT ); Mon, 28 May 2018 06:50:03 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40vYXF1JjTz9ty6w; Mon, 28 May 2018 12:49:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id KjNkMv40sqcc; Mon, 28 May 2018 12:49:49 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 40vYXF0lPFz9ty6Y; Mon, 28 May 2018 12:49:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4E1C28B971; Mon, 28 May 2018 12:49:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id SLR6_IQTM0wg; Mon, 28 May 2018 12:49:54 +0200 (CEST) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 220A18B96E; Mon, 28 May 2018 12:49:54 +0200 (CEST) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 1B1666F10C; Mon, 28 May 2018 10:49:54 +0000 (UTC) Message-Id: <3fe04a4484a92754459233ad9cdbc6198e7a33b3.1527503958.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v5 1/3] powerpc/lib: move PPC32 specific functions out of string.S To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , segher@kernel.crashing.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 28 May 2018 10:49:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation of optimisation patches, move PPC32 specific memcmp() and __clear_user() into string_32.S Signed-off-by: Christophe Leroy --- arch/powerpc/lib/Makefile | 5 +-- arch/powerpc/lib/string.S | 61 ------------------------------------- arch/powerpc/lib/string_32.S | 72 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 63 deletions(-) create mode 100644 arch/powerpc/lib/string_32.S diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 653901042ad7..2c9b8c0adf22 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -26,13 +26,14 @@ obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \ memcpy_power7.o obj64-y += copypage_64.o copyuser_64.o mem_64.o hweight_64.o \ - string_64.o memcpy_64.o memcmp_64.o pmem.o + memcpy_64.o memcmp_64.o pmem.o obj64-$(CONFIG_SMP) += locks.o obj64-$(CONFIG_ALTIVEC) += vmx-helper.o obj64-$(CONFIG_KPROBES_SANITY_TEST) += test_emulate_step.o -obj-y += checksum_$(BITS).o checksum_wrappers.o +obj-y += checksum_$(BITS).o checksum_wrappers.o \ + string_$(BITS).o obj-y += sstep.o ldstfp.o quad.o obj64-y += quad.o diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S index 0378def28d41..b03c1a6861f4 100644 --- a/arch/powerpc/lib/string.S +++ b/arch/powerpc/lib/string.S @@ -56,23 +56,6 @@ _GLOBAL(strncmp) blr EXPORT_SYMBOL(strncmp) -#ifdef CONFIG_PPC32 -_GLOBAL(memcmp) - PPC_LCMPI 0,r5,0 - beq- 2f - mtctr r5 - addi r6,r3,-1 - addi r4,r4,-1 -1: lbzu r3,1(r6) - lbzu r0,1(r4) - subf. r3,r0,r3 - bdnzt 2,1b - blr -2: li r3,0 - blr -EXPORT_SYMBOL(memcmp) -#endif - _GLOBAL(memchr) PPC_LCMPI 0,r5,0 beq- 2f @@ -86,47 +69,3 @@ _GLOBAL(memchr) 2: li r3,0 blr EXPORT_SYMBOL(memchr) - -#ifdef CONFIG_PPC32 -_GLOBAL(__clear_user) - addi r6,r3,-4 - li r3,0 - li r5,0 - cmplwi 0,r4,4 - blt 7f - /* clear a single word */ -11: stwu r5,4(r6) - beqlr - /* clear word sized chunks */ - andi. r0,r6,3 - add r4,r0,r4 - subf r6,r0,r6 - srwi r0,r4,2 - andi. r4,r4,3 - mtctr r0 - bdz 7f -1: stwu r5,4(r6) - bdnz 1b - /* clear byte sized chunks */ -7: cmpwi 0,r4,0 - beqlr - mtctr r4 - addi r6,r6,3 -8: stbu r5,1(r6) - bdnz 8b - blr -90: mr r3,r4 - blr -91: mfctr r3 - slwi r3,r3,2 - add r3,r3,r4 - blr -92: mfctr r3 - blr - - EX_TABLE(11b, 90b) - EX_TABLE(1b, 91b) - EX_TABLE(8b, 92b) - -EXPORT_SYMBOL(__clear_user) -#endif diff --git a/arch/powerpc/lib/string_32.S b/arch/powerpc/lib/string_32.S new file mode 100644 index 000000000000..204db8a834fd --- /dev/null +++ b/arch/powerpc/lib/string_32.S @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * String handling functions for PowerPC32 + * + * Copyright (C) 1996 Paul Mackerras. + * + */ + +#include +#include +#include +#include + + .text + +_GLOBAL(memcmp) + cmpwi cr0, r5, 0 + beq- 2f + mtctr r5 + addi r6,r3,-1 + addi r4,r4,-1 +1: lbzu r3,1(r6) + lbzu r0,1(r4) + subf. r3,r0,r3 + bdnzt 2,1b + blr +2: li r3,0 + blr +EXPORT_SYMBOL(memcmp) + +_GLOBAL(__clear_user) + addi r6,r3,-4 + li r3,0 + li r5,0 + cmplwi 0,r4,4 + blt 7f + /* clear a single word */ +11: stwu r5,4(r6) + beqlr + /* clear word sized chunks */ + andi. r0,r6,3 + add r4,r0,r4 + subf r6,r0,r6 + srwi r0,r4,2 + andi. r4,r4,3 + mtctr r0 + bdz 7f +1: stwu r5,4(r6) + bdnz 1b + /* clear byte sized chunks */ +7: cmpwi 0,r4,0 + beqlr + mtctr r4 + addi r6,r6,3 +8: stbu r5,1(r6) + bdnz 8b + blr +90: mr r3,r4 + blr +91: mfctr r3 + slwi r3,r3,2 + add r3,r3,r4 + blr +92: mfctr r3 + blr + + EX_TABLE(11b, 90b) + EX_TABLE(1b, 91b) + EX_TABLE(8b, 92b) + +EXPORT_SYMBOL(__clear_user) -- 2.13.3