Received: by 10.223.148.5 with SMTP id 5csp6689882wrq; Wed, 17 Jan 2018 17:35:42 -0800 (PST) X-Google-Smtp-Source: ACJfBos/W4gj0CCU2YmNZZk9uTxzMG6ri1qYl69EXg5JEKkx62VcfETjdmoI+17zpzTzc6BR06+f X-Received: by 10.99.54.76 with SMTP id d73mr1939699pga.202.1516239342473; Wed, 17 Jan 2018 17:35:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516239342; cv=none; d=google.com; s=arc-20160816; b=KWk5OuJASwkAaVu+Ebv10LZBkKQg60ZzOc9Okn/IWBSy3KQj5Tnb1Dj0GmnZqE8DBB rvosx58U7nA6vMiN7v6X7Kb9V3XTJSvTFXzFGMqSOYGh/KMCAukSw/lMN5Rv20WQEZmG zwxMZxuMzwn7yOisNeonFj2CDgbSYX6cQbiZx6o80K0Erht/dxJJcomBqO8W3e44jOJv bXNBhZQDD7ItAzXEsQbfGCjpAZM2iMXkYd3L2D2Qmo0ZPBuysFBdpXZw9s/lp3niVVRV h2/l45pwKs0N5eCRANuh+s6V3z52hZQG2NjRrClSa4jX7AeNeaLC+/GW9CRbykm4+u3o qHQg== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=dO1mqa5mpFy3C9dsxFhM3g5Qye/hm791XlPQDQI8mFo=; b=ERBv3V5+JOHC9z1R5G0Pdrk6TuVheauISHhYhCEeRroyxU2r/vctevDf+SZjM7SQWD VuJlXE8UYxXzpadkrVb3Oehhek2YLP5MFtXKyyTpIGQV/wSxmcYrPll4ftbXRibojuRb lQ0Kpr4zgFZBMDrnZqWwfmwQ/6kv3kYifjMgT5NkIpayCCaU3txAZYHJ7ghU1UjiHgJA d2gkA5+KYv7WYIj7mrSU3W7d6Lyel2jebQpQAvZrBxlmAannLxRkNYehnXwcfzBpie6A puWNFq14EeMQskNypBWuk8utuhlds+ryAyhMDUrA1xChqglpjKL1yINwU2BDHDjBS6+M WX/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=WjN3kM1Z; 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 w6si4760943pgq.273.2018.01.17.17.35.27; Wed, 17 Jan 2018 17:35:42 -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=@sifive.com header.s=google header.b=WjN3kM1Z; 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 S1752719AbeARBfC (ORCPT + 99 others); Wed, 17 Jan 2018 20:35:02 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46540 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbeARBfB (ORCPT ); Wed, 17 Jan 2018 20:35:01 -0500 Received: by mail-pg0-f68.google.com with SMTP id s9so10795890pgq.13 for ; Wed, 17 Jan 2018 17:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=dO1mqa5mpFy3C9dsxFhM3g5Qye/hm791XlPQDQI8mFo=; b=WjN3kM1ZpmPlvM/UegWLG/FDbLuyXtjimsXNaZ3G1yYkzzmkrnjDOn07zLVx2gEE5p YdSsXn1u+rKdoKwX2zk4RZFpo+Hyj6A9Hrqz27LQzw1HKGxh+/1Xabtqvqkn4uvRqdrM zA+4Pym1Noh5zWy6AZfkmzQNFqniLH1RYEOmSpvAevqtwUyr5WEdd94JqoQ1j12/5lIV VxFj0R0xDWD19NymWdKkE0c1HSB4xn8ydZoplx4jNGfeUu39ZwVu7OO6hbTBQh195n98 WB4+GlSwVGWRWpO9YwsbbO3eDjLJhGCXEJbCaPLEqARrMg7/Tc0bMHfZV0Q359fhjIoz wxMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=dO1mqa5mpFy3C9dsxFhM3g5Qye/hm791XlPQDQI8mFo=; b=HNb5LnN5PGhPiDRlhnuvzAtZ+8icJLrXr0hnJSybarXJ/2xG5PzpJaOwLQBxGcgwFf 73DCmgXUVg+65MQNRdtnDNs+T4qL6FhG9tJmZBv0m1WxHzbK+RMBO0D2VU/A4QjVroKm Bd0S6UNaLj2fjQFmXsi6trM4m9XWjp33B84OHlZnY1eGaM6HXkDYoo7tbjA/jvZ2Vazx e67rg0by1eJ+r6URya22eVuwIu3hwOaci23SHLktuEBy3SFAMnLRHbqcXKNmZ3C9GpZ7 Li6giC0iqv+rZT29QveuLwfwhQDD54OGKXHmRgf4upis2eR43A5l8f7k8z/49GbgQusE b0Gg== X-Gm-Message-State: AKwxytcan6ckzhCGoeYdZDZbTmXuIPBCxmxEm3EMS0Ya0/QHbLejxMG3 eEePMX17BylqiWiIVIB/GqXbjg== X-Received: by 10.159.207.135 with SMTP id z7mr8869239plo.242.1516239300317; Wed, 17 Jan 2018 17:35:00 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id s14sm10086050pfa.158.2018.01.17.17.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 17:34:59 -0800 (PST) Date: Wed, 17 Jan 2018 17:34:59 -0800 (PST) X-Google-Original-Date: Wed, 17 Jan 2018 17:34:57 PST (-0800) Subject: Re: [PATCH] MIPS: use generic GCC library routines from lib/ In-Reply-To: <20180117065121.30437-1-antonynpavlov@gmail.com> CC: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org From: Palmer Dabbelt To: antonynpavlov@gmail.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ah, thanks for reminding me -- I'd originally posted a patch set that converted every other port to use these routines, but I ended up dropping all those. Here's my original MIPS attempt https://marc.info/?l=linux-mips&m=149677651707103&w=2 Given that, I think you can also drop arch/mips/lib/libgcc.h -- if it's used from anywhere else, it should be possible to use include/linux/libgcc.h instead. Assuming it still seems sane do to that I can go give the rest of the patch set another shot. I'm a bit new to this, but I think I should do something like Reviewed-by: Palmer Dabbelt Thanks! 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) += r3k_dump_tlb.o > obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o > > # libgcc-style stuff needed in the kernel > -obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o ucmpdi2.o > +obj-y += 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 == 0) > - return u; > - > - uu.ll = u; > - bm = 32 - b; > - > - if (bm <= 0) { > - w.s.low = 0; > - w.s.high = (unsigned int) uu.s.low << -bm; > - } else { > - const unsigned int carries = (unsigned int) uu.s.low >> bm; > - > - w.s.low = (unsigned int) uu.s.low << b; > - w.s.high = ((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 == 0) > - return u; > - > - uu.ll = u; > - bm = 32 - b; > - > - if (bm <= 0) { > - /* w.s.high = 1..1 or 0..0 */ > - w.s.high = > - uu.s.high >> 31; > - w.s.low = uu.s.high >> -bm; > - } else { > - const unsigned int carries = (unsigned int) uu.s.high << bm; > - > - w.s.high = uu.s.high >> b; > - w.s.low = ((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 = { > - .ll = a > - }; > - const DWunion bu = { > - .ll = 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 == 0) > - return u; > - > - uu.ll = u; > - bm = 32 - b; > - > - if (bm <= 0) { > - w.s.high = 0; > - w.s.low = (unsigned int) uu.s.high >> -bm; > - } else { > - const unsigned int carries = (unsigned int) uu.s.high << bm; > - > - w.s.high = (unsigned int) uu.s.high >> b; > - w.s.low = ((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 = {.ll = a}; > - const DWunion bu = {.ll = 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);