Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3121563imm; Thu, 17 May 2018 03:52:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZprMb4txEzZ2JtfW6MWnlpEKV/ZX7fLNx+tLL6NpyspAY/sqVVugqXcjWOR26KBXvQNfUJm X-Received: by 2002:a17:902:aa98:: with SMTP id d24-v6mr4694079plr.185.1526554329106; Thu, 17 May 2018 03:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526554329; cv=none; d=google.com; s=arc-20160816; b=dC9HnDCEGQQalg8NwCBQ8dzw9nOAGdBZVltzYM9WrTK/QlcTLNlsTljKnc2bheI8Ra XNN4Mjr4yaiVTy+GLxF23C8DMllWuV2EtqzrNqQSn6WoMJ2l4bB4uhPCuOyz8jUbucZ+ cQ1n2l+EfLig7WiJLfphArPETfeGsc6y8VSYifSyvbTOmbLkkfZxTWw5F5TylWs9ZmVL DmZNPul0sFp4cYx3S0VEn6g1OLyvvbDwW5lhalqJCDZ083giMPRbLZyq8aVfzJZoDQBc XvIuFYI+oLPkiuuIqNyDsE4hWOvoPbEB/gdeW46bhZlcb44f8XiyJuiQaAGW74lWicE5 kl6Q== 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=3flz1FrvtZS/WYvEQW1l7ngiCyqsL1bc/VB80hKo5lo=; b=iFhDxLfKbQauEqZBsat16DAx+LDw11C+P8VYgzpQxOA0ZVTHIlnCkeAgVoOeOs2zuE KTxjn05HjvUyeGoyfOeW2iVQqQM57nyZgPYYUX/HZjX77K+Yg1Q8QK3HiiyMFmfnYzvP OM6S3pCb8roNM6rJ7fadc/wap8NAV88SefxmOjiNqoeUZgNnPNhjkhd2nv2tVmnrWc50 bXqB9YsyyMK0GkSRXWPpO2ibK/dmENsrDicaHHNM2U/76mWtUKdM+sXAR7JcBYEpOMHr AEyTNB0GvuVzRm1fm3m0QELT4AkuVgIrtiiuPk04sUMe8mMPH2xkAYuIbGVwugRbpz8H XbZA== 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 r134-v6si3832170pgr.491.2018.05.17.03.51.54; Thu, 17 May 2018 03:52:09 -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 S1751986AbeEQKty (ORCPT + 99 others); Thu, 17 May 2018 06:49:54 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:51310 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeEQKtw (ORCPT ); Thu, 17 May 2018 06:49:52 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40mp3K63Vxz9v0k3; Thu, 17 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 7C3E5O9HmtlH; Thu, 17 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 40mp3K5R34z9v0k0; Thu, 17 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 18B898B987; Thu, 17 May 2018 12:49:51 +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 WKqw3uYefVAx; Thu, 17 May 2018 12:49:50 +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 DDDAC8B97E; Thu, 17 May 2018 12:49:50 +0200 (CEST) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id D2E076F937; Thu, 17 May 2018 12:49:50 +0200 (CEST) Message-Id: <68d0167111d06a8b21d7e52140bf399d79979e3b.1526553552.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 1/5] powerpc/lib: move PPC32 specific functions out of string.S To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 17 May 2018 12:49:50 +0200 (CEST) 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 | 74 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 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 a026d8fa8a99..0ef189847337 100644 --- a/arch/powerpc/lib/string.S +++ b/arch/powerpc/lib/string.S @@ -59,23 +59,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 @@ -91,47 +74,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..ab8c4f5f31b6 --- /dev/null +++ b/arch/powerpc/lib/string_32.S @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * String handling functions for PowerPC32 + * + * Copyright (C) 2018 CS Systemes d'Information + * + * Author: Christophe Leroy + * + */ + +#include +#include +#include +#include + + .text + +_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) + +_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