Received: by 10.223.148.5 with SMTP id 5csp7965544wrq; Thu, 18 Jan 2018 11:51:31 -0800 (PST) X-Google-Smtp-Source: ACJfBosjqRoGzAjHkABIVlxkkJt90xm7/L7PC3CyW37GnXDmrA1NmukKks5hH4viiLPpVnbLRq9r X-Received: by 10.101.65.3 with SMTP id w3mr23219326pgp.285.1516305091280; Thu, 18 Jan 2018 11:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516305091; cv=none; d=google.com; s=arc-20160816; b=cG9Ss9wjwF4LpvpgoRdJQEs7l5A2dRhtqmm7JYylDo0jgsnceMz354JB4JKM21ezzY rGE/uPx7WyvGSTYjJVqtWf3Y0GU/yAmHA30ww2rB06KflORT7jMUL4m4X3BMRfxaw5JW 7cb/Itd5oU9pN8xzdeZiIy4I/psUis7cev19JyeAXZOhIrboibaIRoG76+vjivTztgHC t99e4ED98QVLHHMwLmdh8A8xuo5Wa6W4uGz0//mZGA24olnjOvaUF5s5Kk/aX/xN0U1D iwzwNtRz1cpqBLCBQV9hcgSIOMxtEcos+RP5f1f/YPsh6mKSRsqrgNm4k2mJfx3D8ZyV Rf0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=80F4dcdOP221pTVGomwb0h73+0invtY8uqP34IFO1M8=; b=TYCX3JeJPG5yxjNq3Ny6M8il/tU5/G4fy2DRDL/CZcwYR+m9jN/iU7hSL+oG+DODOo cqYewCPK/LXkvct91pIsNd2GOAOwYg/JyGiLVM6wbuTqu8aK0xnZ3yWc6ZI2FfkxoHRA 0egTrurTYagc70LTtsiIP+SSQptXtSuDKYp4LjT2ihYIbt94Zny7oglXyu6nrQ4rDPcS Z/R9r0KKGdya3q0fLrUsIh3R2LuDbVw3BGeEtkuluiQ6nv1gUU8Pk+RuOUCQEND7nsEC jvDk96pRvj9oJ42KqiklJPDnupej6rD03Dn53nnCymODQlDoQtnpzfUjUoQX1gEEcLSK 4QOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BGvk43wB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si7557657pfg.271.2018.01.18.11.51.16; Thu, 18 Jan 2018 11:51:31 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BGvk43wB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755478AbeARTuu (ORCPT + 99 others); Thu, 18 Jan 2018 14:50:50 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:38126 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754976AbeARTut (ORCPT ); Thu, 18 Jan 2018 14:50:49 -0500 Received: by mail-lf0-f65.google.com with SMTP id g72so22707235lfg.5 for ; Thu, 18 Jan 2018 11:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=80F4dcdOP221pTVGomwb0h73+0invtY8uqP34IFO1M8=; b=BGvk43wBcJS1oY0l7rTnOwrdMCNF+xnSMRh7xkqaj5wy2VE6Rfi2d8CRZaUoWZc4FO YV+LeBI6HRTr6KbgCLbGGXIs4K+aRIk2DDzE1WjIY3N93O/UiYHrjpgYCehy7Sfh5GIj AbrAb2i4EfR0FJsgqvLmLrrTC3jxyOBchefUrGnfRLV9Yob/y1lkvHQhZM862GTDbO78 HClU9cJ5KIyAg+yFnNJPtfa02XyOJK//kbUa1qIRcsjpigljYj+vQrtg4VE3sQMxKwR+ TakxejF8Am3kKTvu8t2IblhrpLl4faZAFLlWPlxnS4TPs97rQXlzIDI5i727gCqcE6n+ ytiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=80F4dcdOP221pTVGomwb0h73+0invtY8uqP34IFO1M8=; b=bSu/J9MygHIhENWhG6hURGLFH5mcmHQeLoWeHcViPkILeVQ+pNrpaG0Pr8Ytw+GOpu pOT3G3ym48UMjFt0nuC+GOI+yb17U12JmOpSIU4ln6vAhUrvPGRdbfb71PyUNgJjIkXA ySI42Fysste9i2RdsUKx562WH0twOrvAZ6dQ7k72FW1TH3L6pt2EMs0g4mC5FK0wT3H/ P/TN0VCXD68FVOS4Tgg5kWufBjoBs9wWeiSOeagOuCkJ57fkkdiz5bu/cpyhPQAROXP1 3fMifFLnF78vwHq6fEKwfEzC58ewgGpcpwtW/plgi7siFVzEoQIvs7LOd0Y29S0wut9M zTLw== X-Gm-Message-State: AKGB3mIkFRvoJQCzD8cOAdhkEbq49VEDpxNcwCeYZZ5XKVvG0c5MurB6 fqRq/8RWM2gchDiHGdPjiidFMg== X-Received: by 10.46.23.24 with SMTP id l24mr26691196lje.146.1516305047784; Thu, 18 Jan 2018 11:50:47 -0800 (PST) Received: from flare (t35.niisi.ras.ru. [193.232.173.35]) by smtp.gmail.com with ESMTPSA id a86sm1412938ljb.88.2018.01.18.11.50.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 11:50:46 -0800 (PST) Date: Thu, 18 Jan 2018 23:05:05 +0300 From: Antony Pavlov To: Palmer Dabbelt Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org, Matt Redfearn Subject: Re: [PATCH] MIPS: use generic GCC library routines from lib/ Message-Id: <20180118230505.31af9784f543a2e067af5a39@gmail.com> In-Reply-To: References: <20180117065121.30437-1-antonynpavlov@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.25; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Jan 2018 17:34:59 -0800 (PST) Palmer Dabbelt wrote: > Ah, thanks for reminding me -- I'd originally posted a patch set that con= verted=20 > every other port to use these routines, but I ended up dropping all those= . =20 > Here's my original MIPS attempt >=20 > https://marc.info/?l=3Dlinux-mips&m=3D149677651707103&w=3D2 Now I see that I have dubbed your June 2017 patch. Sorry! Alas in June 2017 there was no chance to push your patch to linux-mips repo. Linus merged your patches in November 2017. Ralf merged your RISC-V changes into linux-mips repo AFAIR just several days ago. > Given that, I think you can also drop arch/mips/lib/libgcc.h -- if it's u= sed=20 > from anywhere else, it should be possible to use include/linux/libgcc.h=20 > instead. I agree with you. >=20 > Assuming it still seems sane do to that I can go give the rest of the pat= ch set=20 > another shot. I'm a bit new to this, but I think I should do something l= ike >=20 > Reviewed-by: Palmer Dabbelt I suppose that it's better to resurrect you patch and abandon my patch. Your original patch series (https://www.linux-mips.org/archives/linux-mips/= 2017-06/msg00148.html) has a disadvantage: it tries to change several architectures at once. I propose to create new short separate patch series for MIPS architecture. This patch series should contain two patches: [PATCH 1/2] Add notrace to lib/ucmpdi2.c [PATCH 2/2] MIPS: Use generic libgcc intrinsics > Thanks! >=20 > On Tue, 16 Jan 2018 22:51:21 PST (-0800), antonynpavlov@gmail.com wrote: > > The commit b35cd9884fa5 ("lib: Add shared copies of > > some GCC library routines") makes it possible > > to share generic GCC library routines by several > > architectures. > > > > This commit removes several generic GCC library > > routines from arch/mips/lib/ in favour of similar > > routines from lib/. > > > > Signed-off-by: Antony Pavlov > > Cc: Palmer Dabbelt > > Cc: Ralf Baechle > > Cc: linux-mips@linux-mips.org > > Cc: linux-kernel@vger.kernel.org > > --- > > arch/mips/Kconfig | 5 +++++ > > arch/mips/lib/Makefile | 2 +- > > arch/mips/lib/ashldi3.c | 30 ------------------------------ > > arch/mips/lib/ashrdi3.c | 32 -------------------------------- > > arch/mips/lib/cmpdi2.c | 28 ---------------------------- > > arch/mips/lib/lshrdi3.c | 30 ------------------------------ > > arch/mips/lib/ucmpdi2.c | 22 ---------------------- > > 7 files changed, 6 insertions(+), 143 deletions(-) > > delete mode 100644 arch/mips/lib/ashldi3.c > > delete mode 100644 arch/mips/lib/ashrdi3.c > > delete mode 100644 arch/mips/lib/cmpdi2.c > > delete mode 100644 arch/mips/lib/lshrdi3.c > > delete mode 100644 arch/mips/lib/ucmpdi2.c > > > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > > index 350a990fc719..9cd49ee848c6 100644 > > --- a/arch/mips/Kconfig > > +++ b/arch/mips/Kconfig > > @@ -73,6 +73,11 @@ config MIPS > > select RTC_LIB if !MACH_LOONGSON64 > > select SYSCTL_EXCEPTION_TRACE > > select VIRT_TO_BUS > > + select GENERIC_ASHLDI3 > > + select GENERIC_ASHRDI3 > > + select GENERIC_LSHRDI3 > > + select GENERIC_CMPDI2 > > + select GENERIC_UCMPDI2 > > > > menu "Machine selection" > > > > diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile > > index 78c2affeabf8..195ab4cb0840 100644 > > --- a/arch/mips/lib/Makefile > > +++ b/arch/mips/lib/Makefile > > @@ -16,4 +16,4 @@ obj-$(CONFIG_CPU_R3000) +=3D r3k_dump_tlb.o > > obj-$(CONFIG_CPU_TX39XX) +=3D r3k_dump_tlb.o > > > > # libgcc-style stuff needed in the kernel > > -obj-y +=3D ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o = ucmpdi2.o > > +obj-y +=3D bswapsi.o bswapdi.o > > diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c > > deleted file mode 100644 > > index 24cd6903e797..000000000000 > > --- a/arch/mips/lib/ashldi3.c > > +++ /dev/null > > @@ -1,30 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0 > > -#include > > - > > -#include "libgcc.h" > > - > > -long long notrace __ashldi3(long long u, word_type b) > > -{ > > - DWunion uu, w; > > - word_type bm; > > - > > - if (b =3D=3D 0) > > - return u; > > - > > - uu.ll =3D u; > > - bm =3D 32 - b; > > - > > - if (bm <=3D 0) { > > - w.s.low =3D 0; > > - w.s.high =3D (unsigned int) uu.s.low << -bm; > > - } else { > > - const unsigned int carries =3D (unsigned int) uu.s.low >> bm; > > - > > - w.s.low =3D (unsigned int) uu.s.low << b; > > - w.s.high =3D ((unsigned int) uu.s.high << b) | carries; > > - } > > - > > - return w.ll; > > -} > > - > > -EXPORT_SYMBOL(__ashldi3); > > diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c > > deleted file mode 100644 > > index 23f5295af51e..000000000000 > > --- a/arch/mips/lib/ashrdi3.c > > +++ /dev/null > > @@ -1,32 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0 > > -#include > > - > > -#include "libgcc.h" > > - > > -long long notrace __ashrdi3(long long u, word_type b) > > -{ > > - DWunion uu, w; > > - word_type bm; > > - > > - if (b =3D=3D 0) > > - return u; > > - > > - uu.ll =3D u; > > - bm =3D 32 - b; > > - > > - if (bm <=3D 0) { > > - /* w.s.high =3D 1..1 or 0..0 */ > > - w.s.high =3D > > - uu.s.high >> 31; > > - w.s.low =3D uu.s.high >> -bm; > > - } else { > > - const unsigned int carries =3D (unsigned int) uu.s.high << bm; > > - > > - w.s.high =3D uu.s.high >> b; > > - w.s.low =3D ((unsigned int) uu.s.low >> b) | carries; > > - } > > - > > - return w.ll; > > -} > > - > > -EXPORT_SYMBOL(__ashrdi3); > > diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c > > deleted file mode 100644 > > index 93cfc785927d..000000000000 > > --- a/arch/mips/lib/cmpdi2.c > > +++ /dev/null > > @@ -1,28 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0 > > -#include > > - > > -#include "libgcc.h" > > - > > -word_type notrace __cmpdi2(long long a, long long b) > > -{ > > - const DWunion au =3D { > > - .ll =3D a > > - }; > > - const DWunion bu =3D { > > - .ll =3D b > > - }; > > - > > - if (au.s.high < bu.s.high) > > - return 0; > > - else if (au.s.high > bu.s.high) > > - return 2; > > - > > - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) > > - return 0; > > - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) > > - return 2; > > - > > - return 1; > > -} > > - > > -EXPORT_SYMBOL(__cmpdi2); > > diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c > > deleted file mode 100644 > > index 914b971aca3b..000000000000 > > --- a/arch/mips/lib/lshrdi3.c > > +++ /dev/null > > @@ -1,30 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0 > > -#include > > - > > -#include "libgcc.h" > > - > > -long long notrace __lshrdi3(long long u, word_type b) > > -{ > > - DWunion uu, w; > > - word_type bm; > > - > > - if (b =3D=3D 0) > > - return u; > > - > > - uu.ll =3D u; > > - bm =3D 32 - b; > > - > > - if (bm <=3D 0) { > > - w.s.high =3D 0; > > - w.s.low =3D (unsigned int) uu.s.high >> -bm; > > - } else { > > - const unsigned int carries =3D (unsigned int) uu.s.high << bm; > > - > > - w.s.high =3D (unsigned int) uu.s.high >> b; > > - w.s.low =3D ((unsigned int) uu.s.low >> b) | carries; > > - } > > - > > - return w.ll; > > -} > > - > > -EXPORT_SYMBOL(__lshrdi3); > > diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c > > deleted file mode 100644 > > index c31c78ca4175..000000000000 > > --- a/arch/mips/lib/ucmpdi2.c > > +++ /dev/null > > @@ -1,22 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0 > > -#include > > - > > -#include "libgcc.h" > > - > > -word_type notrace __ucmpdi2(unsigned long long a, unsigned long long b) > > -{ > > - const DWunion au =3D {.ll =3D a}; > > - const DWunion bu =3D {.ll =3D b}; > > - > > - if ((unsigned int) au.s.high < (unsigned int) bu.s.high) > > - return 0; > > - else if ((unsigned int) au.s.high > (unsigned int) bu.s.high) > > - return 2; > > - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) > > - return 0; > > - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) > > - return 2; > > - return 1; > > -} > > - > > -EXPORT_SYMBOL(__ucmpdi2); --=20 Best regards, =A0 Antony Pavlov