Received: by 10.223.148.5 with SMTP id 5csp7969741wrq; Thu, 18 Jan 2018 11:55:41 -0800 (PST) X-Google-Smtp-Source: ACJfBov/YJQuyTNwpGSgDrgkEc0ToMzcVKgGoI3b1SL1gi8af0BKKd5tXb6Km30sz2EuPUv5T56G X-Received: by 10.98.7.73 with SMTP id b70mr16025053pfd.39.1516305341749; Thu, 18 Jan 2018 11:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516305341; cv=none; d=google.com; s=arc-20160816; b=M33kTC0CkoSPdHKYmpWQ+SXtPvej+K9ftw0/MbSIWSxK4eTlHfH7UrnR7jXMa8teRl tMqEyYoSMJfjFBvNScDs85RhQpa9BdSDQbnm3FiIcITCbrQPdQRVRX2D4OsUi8DDlOCQ C/b4JxWN4I1Zt13ZvmUN8Xwe6cRi0Njz1kdqOTIBQyqQdPpEAOz/4hGIJYehNU6M/ziK Ocry84L7ZJO/+lK6qpa/7fvCw5UibM8sRtBeW7RPdahl7+uZo08MoJWFeUsS6sC0+FLI I/5svbOYSMr84P5fmM6KtruMFlla+rVlVEyRUtU1kkk7Bl+Xvpk3os+9AwD1KTgPVESv i7Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to:date :dkim-signature:arc-authentication-results; bh=4bUJHdYnGF/TTP3dTbnzxcCRITQm/zpiWmwI0CtpPTg=; b=Bt3mRQncbukRFovMwTn4o+okSi/JMd2XUIuZD9SMJuNonEpoK2xC3hCFJYZepzvrEM E9lc39z0kKcQL1ZPV/QGR4AD1771LU3iqArstDPvnMkdR1jlej34a6vt9TL9HTzKuGXE b6G0SJ+WKHFSNoLJ8nvp11mKzeeL4es4Vh1jH6gXC2pyZiCg9nnZQ7J5GjtiCfvhUE6n dr2gjnau06rzeWvV6OyqABWZD2pPTaAaBE5UkKAYwHzrWpuv0Skr/2dJY3PZeK5mkGGB I03g3sBevyCTwcGxSapa4/8SPSNs9P6Fmq7Vm8epMPmOjr912dv3jElNenfZG+SLxX4m Vo9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@albanarts-com.20150623.gappssmtp.com header.s=20150623 header.b=pymbTkmD; 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 m2si7477550pfh.158.2018.01.18.11.55.17; Thu, 18 Jan 2018 11:55:41 -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=fail header.i=@albanarts-com.20150623.gappssmtp.com header.s=20150623 header.b=pymbTkmD; 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 S932493AbeARTyw (ORCPT + 99 others); Thu, 18 Jan 2018 14:54:52 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35802 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932269AbeARTyv (ORCPT ); Thu, 18 Jan 2018 14:54:51 -0500 Received: by mail-wr0-f196.google.com with SMTP id g38so20629391wrd.2 for ; Thu, 18 Jan 2018 11:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=albanarts-com.20150623.gappssmtp.com; s=20150623; h=date:in-reply-to:references:mime-version:content-transfer-encoding :subject:to:cc:from:message-id; bh=4bUJHdYnGF/TTP3dTbnzxcCRITQm/zpiWmwI0CtpPTg=; b=pymbTkmDRtt9bObdmBXdL6H6x7CWAg+f+UKu9MfahEIQt5V0Tyla6IzWsYHZf5OG+i WDk8jJP7BEzkMcNmbHb3nCZsMzrHfO1NuMXSBoy2HvXXbGBjgmgPLDHcZprRJrYdL0uN 6dEhIcIBRvXOP7UbBMlDW5ETwfuK4ZA4gAXZPHWqJZNJ/5e0B93tWmz4aPZMQNvECjik jFzdVWmJmPxZIWyrTxajAi17iE4s5FJqGTbyL9oz17XUFEpg+gqmiTirHFf29lnK/gGB FjhJcQaP3AzSCVhrMPpJcgJR0jnZv2Ur/zbjmZMUe3oQG/RPwvr9iVb0QG95w0YI2b0C LKJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=4bUJHdYnGF/TTP3dTbnzxcCRITQm/zpiWmwI0CtpPTg=; b=cG2W35Dl53dyER+xZMMRnduEBCxF7r/4lBH7uoUfpPkPpDTTeVl9Fybf+GbabbtrZS ksYA3vmjguyg4g/Rz7UV7u3o5IWzRfkbCrTzx8gFDjM/JnzkVIZ1w71DEgLZmeFiLtk0 D/wWBrbGS6lCyWUn+oK2dF+Fqi+UO4kfjW5q9yK2hcB0UuOJWwrPFlsAbDsgW0TVi5YE /oQ7aBocyJ3OtUWkEdF14MCTJBuHgMEPETMFnAPb+l7TNp4dMn2QGbZ5s/WdZuADb1ly r58vfaqNcllhiM2EBqJMCInBbrf9SKbaaiX5++alqfz6IfQvuUyBvtp5qDdA0cDEmzBj 15+g== X-Gm-Message-State: AKwxytfGPYAmu+HnYL8Gt0ERbJZZgqqTxdze6X7vLJoXv1OgGh1HaLyc TEP7lfZ52aldaD7dUkVuiiknqg== X-Received: by 10.223.170.150 with SMTP id h22mr7610047wrc.21.1516305290280; Thu, 18 Jan 2018 11:54:50 -0800 (PST) Received: from android-f8911984c6e3e13 (jahogan.plus.com. [212.159.75.221]) by smtp.gmail.com with ESMTPSA id y19sm6138492wrg.84.2018.01.18.11.54.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 11:54:49 -0800 (PST) Date: Thu, 18 Jan 2018 19:54:49 +0000 In-Reply-To: <20180118230505.31af9784f543a2e067af5a39@gmail.com> References: <20180117065121.30437-1-antonynpavlov@gmail.com> <20180118230505.31af9784f543a2e067af5a39@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] MIPS: use generic GCC library routines from lib/ To: Antony Pavlov , Palmer Dabbelt CC: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org, Matt Redfearn From: James Hogan Message-ID: <57124790-F7C9-4180-AE89-A7FAA3DBDC9A@albanarts.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18 January 2018 20:05:05 GMT+00:00, Antony Pavlov wrote: >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 >converted=20 >> every other port to use these routines, but I ended up dropping all >those=2E =20 >> Here's my original MIPS attempt >>=20 >> https://marc=2Einfo/?l=3Dlinux-mips&m=3D149677651707103&w=3D2 > >Now I see that I have dubbed your June 2017 patch=2E Sorry! > >Alas in June 2017 there was no chance to push your patch to linux-mips >repo=2E >Linus merged your patches in November 2017=2E Ralf merged your RISC-V >changes >into linux-mips repo AFAIR just several days ago=2E > >> Given that, I think you can also drop arch/mips/lib/libgcc=2Eh -- if >it's used=20 >> from anywhere else, it should be possible to use >include/linux/libgcc=2Eh=20 >> instead=2E > >I agree with you=2E actually theres a patch in mips-next which implements __multi3 for mips64r= 6, which uses that file, and in fact extends it for 128bit types=2E cheers James > >>=20 >> Assuming it still seems sane do to that I can go give the rest of the >patch set=20 >> another shot=2E I'm a bit new to this, but I think I should do >something like >>=20 >> Reviewed-by: Palmer Dabbelt > >I suppose that it's better to resurrect you patch and abandon my patch=2E > >Your original patch series >(https://www=2Elinux-mips=2Eorg/archives/linux-mips/2017-06/msg00148=2Eht= ml) >has a disadvantage: it tries to change several architectures at once=2E > >I propose to create new short separate patch series for MIPS >architecture=2E > >This patch series should contain two patches: > > [PATCH 1/2] Add notrace to lib/ucmpdi2=2Ec > [PATCH 2/2] MIPS: Use generic libgcc intrinsics > > >> Thanks! >>=20 >> On Tue, 16 Jan 2018 22:51:21 PST (-0800), antonynpavlov@gmail=2Ecom >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=2E >> > >> > This commit removes several generic GCC library >> > routines from arch/mips/lib/ in favour of similar >> > routines from lib/=2E >> > >> > Signed-off-by: Antony Pavlov >> > Cc: Palmer Dabbelt >> > Cc: Ralf Baechle >> > Cc: linux-mips@linux-mips=2Eorg >> > Cc: linux-kernel@vger=2Ekernel=2Eorg >> > --- >> > arch/mips/Kconfig | 5 +++++ >> > arch/mips/lib/Makefile | 2 +- >> > arch/mips/lib/ashldi3=2Ec | 30 ------------------------------ >> > arch/mips/lib/ashrdi3=2Ec | 32 -------------------------------- >> > arch/mips/lib/cmpdi2=2Ec | 28 ---------------------------- >> > arch/mips/lib/lshrdi3=2Ec | 30 ------------------------------ >> > arch/mips/lib/ucmpdi2=2Ec | 22 ---------------------- >> > 7 files changed, 6 insertions(+), 143 deletions(-) >> > delete mode 100644 arch/mips/lib/ashldi3=2Ec >> > delete mode 100644 arch/mips/lib/ashrdi3=2Ec >> > delete mode 100644 arch/mips/lib/cmpdi2=2Ec >> > delete mode 100644 arch/mips/lib/lshrdi3=2Ec >> > delete mode 100644 arch/mips/lib/ucmpdi2=2Ec >> > >> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig >> > index 350a990fc719=2E=2E9cd49ee848c6 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=2E=2E195ab4cb0840 100644 >> > --- a/arch/mips/lib/Makefile >> > +++ b/arch/mips/lib/Makefile >> > @@ -16,4 +16,4 @@ obj-$(CONFIG_CPU_R3000) +=3D r3k_dump_tlb=2Eo >> > obj-$(CONFIG_CPU_TX39XX) +=3D r3k_dump_tlb=2Eo >> > >> > # libgcc-style stuff needed in the kernel >> > -obj-y +=3D ashldi3=2Eo ashrdi3=2Eo bswapsi=2Eo bswapdi=2Eo cmpdi2=2E= o >lshrdi3=2Eo ucmpdi2=2Eo >> > +obj-y +=3D bswapsi=2Eo bswapdi=2Eo >> > diff --git a/arch/mips/lib/ashldi3=2Ec b/arch/mips/lib/ashldi3=2Ec >> > deleted file mode 100644 >> > index 24cd6903e797=2E=2E000000000000 >> > --- a/arch/mips/lib/ashldi3=2Ec >> > +++ /dev/null >> > @@ -1,30 +0,0 @@ >> > -// SPDX-License-Identifier: GPL-2=2E0 >> > -#include >> > - >> > -#include "libgcc=2Eh" >> > - >> > -long long notrace __ashldi3(long long u, word_type b) >> > -{ >> > - DWunion uu, w; >> > - word_type bm; >> > - >> > - if (b =3D=3D 0) >> > - return u; >> > - >> > - uu=2Ell =3D u; >> > - bm =3D 32 - b; >> > - >> > - if (bm <=3D 0) { >> > - w=2Es=2Elow =3D 0; >> > - w=2Es=2Ehigh =3D (unsigned int) uu=2Es=2Elow << -bm; >> > - } else { >> > - const unsigned int carries =3D (unsigned int) uu=2Es=2Elow >> bm; >> > - >> > - w=2Es=2Elow =3D (unsigned int) uu=2Es=2Elow << b; >> > - w=2Es=2Ehigh =3D ((unsigned int) uu=2Es=2Ehigh << b) | carries; >> > - } >> > - >> > - return w=2Ell; >> > -} >> > - >> > -EXPORT_SYMBOL(__ashldi3); >> > diff --git a/arch/mips/lib/ashrdi3=2Ec b/arch/mips/lib/ashrdi3=2Ec >> > deleted file mode 100644 >> > index 23f5295af51e=2E=2E000000000000 >> > --- a/arch/mips/lib/ashrdi3=2Ec >> > +++ /dev/null >> > @@ -1,32 +0,0 @@ >> > -// SPDX-License-Identifier: GPL-2=2E0 >> > -#include >> > - >> > -#include "libgcc=2Eh" >> > - >> > -long long notrace __ashrdi3(long long u, word_type b) >> > -{ >> > - DWunion uu, w; >> > - word_type bm; >> > - >> > - if (b =3D=3D 0) >> > - return u; >> > - >> > - uu=2Ell =3D u; >> > - bm =3D 32 - b; >> > - >> > - if (bm <=3D 0) { >> > - /* w=2Es=2Ehigh =3D 1=2E=2E1 or 0=2E=2E0 */ >> > - w=2Es=2Ehigh =3D >> > - uu=2Es=2Ehigh >> 31; >> > - w=2Es=2Elow =3D uu=2Es=2Ehigh >> -bm; >> > - } else { >> > - const unsigned int carries =3D (unsigned int) uu=2Es=2Ehigh << bm; >> > - >> > - w=2Es=2Ehigh =3D uu=2Es=2Ehigh >> b; >> > - w=2Es=2Elow =3D ((unsigned int) uu=2Es=2Elow >> b) | carries; >> > - } >> > - >> > - return w=2Ell; >> > -} >> > - >> > -EXPORT_SYMBOL(__ashrdi3); >> > diff --git a/arch/mips/lib/cmpdi2=2Ec b/arch/mips/lib/cmpdi2=2Ec >> > deleted file mode 100644 >> > index 93cfc785927d=2E=2E000000000000 >> > --- a/arch/mips/lib/cmpdi2=2Ec >> > +++ /dev/null >> > @@ -1,28 +0,0 @@ >> > -// SPDX-License-Identifier: GPL-2=2E0 >> > -#include >> > - >> > -#include "libgcc=2Eh" >> > - >> > -word_type notrace __cmpdi2(long long a, long long b) >> > -{ >> > - const DWunion au =3D { >> > - =2Ell =3D a >> > - }; >> > - const DWunion bu =3D { >> > - =2Ell =3D b >> > - }; >> > - >> > - if (au=2Es=2Ehigh < bu=2Es=2Ehigh) >> > - return 0; >> > - else if (au=2Es=2Ehigh > bu=2Es=2Ehigh) >> > - return 2; >> > - >> > - if ((unsigned int) au=2Es=2Elow < (unsigned int) bu=2Es=2Elow) >> > - return 0; >> > - else if ((unsigned int) au=2Es=2Elow > (unsigned int) bu=2Es=2Elow) >> > - return 2; >> > - >> > - return 1; >> > -} >> > - >> > -EXPORT_SYMBOL(__cmpdi2); >> > diff --git a/arch/mips/lib/lshrdi3=2Ec b/arch/mips/lib/lshrdi3=2Ec >> > deleted file mode 100644 >> > index 914b971aca3b=2E=2E000000000000 >> > --- a/arch/mips/lib/lshrdi3=2Ec >> > +++ /dev/null >> > @@ -1,30 +0,0 @@ >> > -// SPDX-License-Identifier: GPL-2=2E0 >> > -#include >> > - >> > -#include "libgcc=2Eh" >> > - >> > -long long notrace __lshrdi3(long long u, word_type b) >> > -{ >> > - DWunion uu, w; >> > - word_type bm; >> > - >> > - if (b =3D=3D 0) >> > - return u; >> > - >> > - uu=2Ell =3D u; >> > - bm =3D 32 - b; >> > - >> > - if (bm <=3D 0) { >> > - w=2Es=2Ehigh =3D 0; >> > - w=2Es=2Elow =3D (unsigned int) uu=2Es=2Ehigh >> -bm; >> > - } else { >> > - const unsigned int carries =3D (unsigned int) uu=2Es=2Ehigh << bm; >> > - >> > - w=2Es=2Ehigh =3D (unsigned int) uu=2Es=2Ehigh >> b; >> > - w=2Es=2Elow =3D ((unsigned int) uu=2Es=2Elow >> b) | carries; >> > - } >> > - >> > - return w=2Ell; >> > -} >> > - >> > -EXPORT_SYMBOL(__lshrdi3); >> > diff --git a/arch/mips/lib/ucmpdi2=2Ec b/arch/mips/lib/ucmpdi2=2Ec >> > deleted file mode 100644 >> > index c31c78ca4175=2E=2E000000000000 >> > --- a/arch/mips/lib/ucmpdi2=2Ec >> > +++ /dev/null >> > @@ -1,22 +0,0 @@ >> > -// SPDX-License-Identifier: GPL-2=2E0 >> > -#include >> > - >> > -#include "libgcc=2Eh" >> > - >> > -word_type notrace __ucmpdi2(unsigned long long a, unsigned long >long b) >> > -{ >> > - const DWunion au =3D {=2Ell =3D a}; >> > - const DWunion bu =3D {=2Ell =3D b}; >> > - >> > - if ((unsigned int) au=2Es=2Ehigh < (unsigned int) bu=2Es=2Ehigh) >> > - return 0; >> > - else if ((unsigned int) au=2Es=2Ehigh > (unsigned int) bu=2Es=2Ehig= h) >> > - return 2; >> > - if ((unsigned int) au=2Es=2Elow < (unsigned int) bu=2Es=2Elow) >> > - return 0; >> > - else if ((unsigned int) au=2Es=2Elow > (unsigned int) bu=2Es=2Elow) >> > - return 2; >> > - return 1; >> > -} >> > - >> > -EXPORT_SYMBOL(__ucmpdi2); --=20 Cheers James Hogan