Received: by 10.223.176.5 with SMTP id f5csp1518157wra; Wed, 31 Jan 2018 07:36:17 -0800 (PST) X-Google-Smtp-Source: AH8x224yyUW7xN5LCjATYjCHSl3eThQk37oSMhd09uFFvXgMlJtIbANuYIQhf7jM5qyaKQ+wfBSL X-Received: by 2002:a17:902:4:: with SMTP id 4-v6mr28646682pla.187.1517412977371; Wed, 31 Jan 2018 07:36:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517412977; cv=none; d=google.com; s=arc-20160816; b=AD++DUGCz9AjneaHz0rPQfK+hmemNtAhmhsMVryicRKBeFQKtAAczBaR0BAL90Mg0/ teivqRNy1fb7uisXr6AkKs8frRl2DNbEqUzLVP/3QXfcSZwvzk8RkeZYCaJITTbvoOQm 4p8SnxoO4Lec3Czek26oXc4VwMhmUmePHxghoGY1+WWxUnPS2caRYuhEcDjjgBDQR3zr HoHznfx2S4mCZHY+/ElenSJVog9sljSxUkkpkB8bmu/3FbgkNSBuu+6lRpBGumgMFBD6 M3haicB2H51jqnlS5AiqzAud/jRDVQ9JbwT0HTjOHVrJrmb0rbrN2iMqe8VCV3N1Fv/w tGqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=o733RUxoTYMaVmNks4XK8b05tA9540+q2HD5u7DVrlw=; b=qiZ8LIOwij+fE+Aw2AsguihiKSDyjKTrMdwcj3RKc+ko59TBrBJ6QdNfORVU7ctDPl x2GsgD5P7qMJp56YqewXKIDoAWLy8LQ7i8Si1uA8A05Cg79LhUI8LxRvScGt8/bEvlni vQ5s+pwgkIJs4h5N2PDkHE+5BxfVpCMJiPH9KxS1Nj3i1BcSuASsTBX37pEyrhsXPxmT Z6s6/9/JVTo/VfIXfYC+gInbpEPqEoTUO/YjXlIZE00+sd5INycwLzyWhX79IQ+PZY1v EVWoxkHT7PHBpUAW4YQaydLxG5U0RSp1DWYUGHJUNaY/POz5l3mMebW+3RUZBtHYGkwE 3q9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qWTqO+MY; 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 s185si3343376pgc.308.2018.01.31.07.36.02; Wed, 31 Jan 2018 07:36:17 -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=qWTqO+MY; 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 S932233AbeAaPdv (ORCPT + 99 others); Wed, 31 Jan 2018 10:33:51 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35939 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049AbeAaPdp (ORCPT ); Wed, 31 Jan 2018 10:33:45 -0500 Received: by mail-lf0-f68.google.com with SMTP id t79so21361992lfe.3 for ; Wed, 31 Jan 2018 07:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o733RUxoTYMaVmNks4XK8b05tA9540+q2HD5u7DVrlw=; b=qWTqO+MYesF7SkHFo9bP96sPNXKO6NhF7/zc3ixTXwc0NzWmmgN5qP1FALpAq55ObN EGjzO9ViFSbttwd67kG1AQ2GauUvhCmApV16yDNhoedvKl0EtzDCNEpaBVpkCdqGOElk bGHzGtohUw7PsA7K3+2P+jfCogroGR3n9VoZte+ngL9gBwUEun34Qd5AEKoefjTOiLGM 5XQ5N/Dw7rZOScmPKDDw6KaupZJfnwgb0Ge+kUyD+IvkrFuhFoT4plPiKhqOOePQ0jBk HM+G5LNp6jPdhbB/IvQvf4jaT9fMnY+uUagO0D/o7iRrcNqhO0LIibSh1Hir/rej0VNA zkKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o733RUxoTYMaVmNks4XK8b05tA9540+q2HD5u7DVrlw=; b=ewSaHujchdizQI5lYqB4if380xCNKkV8Cg5PcbbkSatKgGB4uOwGV5k1czLUZbHJs3 Aa8i4pytZ4iTn3XwlPb6k62ItZJrFQudoit6mo75NFbvbbbdKSKjDITjFuXRXBbpEenT DVAJcAXrLv66g5rBmI7MfFueaPSW7pV7qBL1Bwb6Y2vbiz2Ufw3x04wCtQLxMbmFpGol qd54WC/vlKhPl9SVarYmZcS9clgG7/ef2m35Jrb1Z6YKzJB6ngU2OdBHoDxjIpnhXeDv YTPGsVlnslu7Kobx7qd1qnZqa30cQpFgpjib9ilNff6afu6R6Y2o/gO261/eadYYecPZ mpwQ== X-Gm-Message-State: AKwxytcaUzfLJ+D2DKCNyou0cJMW9mKUXwGzLETc/JG6QJmIkGE35cQd tqK55QKEEdvTGpPeBSfvExM= X-Received: by 10.25.67.67 with SMTP id m3mr20456275lfj.105.1517412823917; Wed, 31 Jan 2018 07:33:43 -0800 (PST) Received: from localhost.localdomain (t109.niisi.ras.ru. [193.232.173.109]) by smtp.gmail.com with ESMTPSA id u72sm3952454lfi.64.2018.01.31.07.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 07:33:43 -0800 (PST) From: Antony Pavlov To: linux-mips@linux-mips.org Cc: James Hogan , Ralf Baechle , linux-kernel@vger.kernel.org, Palmer Dabbelt , Matt Redfearn Subject: [PATCH v3 2/2] MIPS: use generic GCC library routines from lib/ Date: Wed, 31 Jan 2018 18:33:37 +0300 Message-Id: <20180131153337.29021-3-antonynpavlov@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180131153337.29021-1-antonynpavlov@gmail.com> References: <20180131153337.29021-1-antonynpavlov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Matt Redfearn Cc: James Hogan 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(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 350a990fc719..b63a5422d485 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -18,16 +18,21 @@ config MIPS select BUILDTIME_EXTABLE_SORT select CLONE_BACKWARDS select CPU_PM if CPU_IDLE + select GENERIC_ASHLDI3 + select GENERIC_ASHRDI3 select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS select GENERIC_CMOS_UPDATE + select GENERIC_CMPDI2 select GENERIC_CPU_AUTOPROBE select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW + select GENERIC_LSHRDI3 select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL + select GENERIC_UCMPDI2 select HANDLE_DOMAIN_IRQ select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KGDB 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); -- 2.15.1