Received: by 10.223.176.5 with SMTP id f5csp477775wra; Tue, 30 Jan 2018 14:43:28 -0800 (PST) X-Google-Smtp-Source: AH8x226s70RvqrxNmbtlTqR4nSF99GkJv7tcXYUzRAH8maqOJpVgjRvV5c8NaEGvFbRXiMIPtUuj X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr27014575plc.20.1517352208803; Tue, 30 Jan 2018 14:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517352208; cv=none; d=google.com; s=arc-20160816; b=WwuzoMsafmB63XgFhhau8bLehqkImTCUQOvJaKPQyqU0/e5iPYCIzzELgwfq/lIIs/ 7H29wI8ILL1Qx0ffZ1PNgfFSu9vJWY2VaDMF36ZF0V4nRZDabWnrOqWvlqmI8Lmm8urs 8sLbTU9voaTlgc8xtDAi5aoh2zKnOSiAhsO4QcAI/F9z29ABpJqZgng4+Rd0pgS4O7bb HKGWeRndT0Q0GvobzVhWFPiTWab+UYLTgedEsr+QE6xhq0Zhp8cmNEbBhqcgoAF0HGKD lMxY1iK3a8vMjOjMAyHtG+Ka4VyLFTlLDA+J8tBZUwO+12KCuz3PAZOuN3v9T7wxl4S0 7Lhw== 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=4F07Dv3QeLawFAyJ7n5oqxZ6Jt648H/ZbBTASvBBY0g=; b=w/UBlEqonfcCU1P4WNHU149VeLiXhvwRm/eKWhRifhmNxEuC1aRPKjc7yxqixRkboP qOKfMrC4fdjB+6onx6W2zW76s8Dt0Wkv5i18w+23QfvQkwCdNn6TyinF/zGMz5M7ekTh uXxHgKtjsCnfqOMlvRQL1HFo7lDCacGHt+Q6nLarFf076SBCPdy5TsxrdRsodoO0ZrD6 Qof4LxrXUpJ/fzwWoVjH4mt1GHp/HJfnbfimhWk7YWOqaqsuHXwrZ8UZyQZq6u9nJAgq vJtVUwb92BmcToPOOZWrN8afQ4KxtTYiAnItr71G6LNvK2iCmMOPAg2Ef0TbrIethE76 6ZJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SQ11D4GF; 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 d10-v6si507207plo.518.2018.01.30.14.43.14; Tue, 30 Jan 2018 14:43:28 -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=SQ11D4GF; 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 S1753728AbeA3WmN (ORCPT + 99 others); Tue, 30 Jan 2018 17:42:13 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:46009 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbeA3WmL (ORCPT ); Tue, 30 Jan 2018 17:42:11 -0500 Received: by mail-lf0-f66.google.com with SMTP id x196so17775686lfd.12 for ; Tue, 30 Jan 2018 14:42:10 -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=4F07Dv3QeLawFAyJ7n5oqxZ6Jt648H/ZbBTASvBBY0g=; b=SQ11D4GFTKzDUnUtJ77UoWnTd34ndd0b7yGrzJCONcqWM3do3jKl2rD5iaPato7QoE Yb8T2Zs0BhPSq6iM49oahKXc+d0d2xuSZwzLTPUGEFgKEpzeGKLdqa1vz8VBgH0pSmap R8gt/51qRXSoFC8WRldpXdHM1DoDXvH0z2nNbUlavqOHAbujbS/h39BAAucqVs1m9SRz vOrqbE8ooU7pPMHjHUo0H+CF8g6cO5Iy6sZJgiP3xzKB5XNc+4zjY774/SAk10Wxls5C z+o5HD4B4h0jzzgGKWRhhck85CE45DHo7wXoF3uCsr/5zYJHCWxJJHRyZKwdkf719pno gEeA== 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=4F07Dv3QeLawFAyJ7n5oqxZ6Jt648H/ZbBTASvBBY0g=; b=MIWxw3ZrykNic7McOhvXlKFkSbnAtiNCkkcFq1m5vWc+s3kXIef9A7tq0hr5w5CaHJ vRYNLf6SyOJGmF7lv1iAGcR1i2sHgc+trAjt1Ue4kyE3Dna2HlaYU9zj4UU2Dla1Y1ZG 8So5U0PMnyK7h6uI6Ils/PcFGspHn8lUxlK4ZvlTpFnS6GPEg+qUy9mcMDwLqL2JwStV oHqPO1JTQfsH2EIpPsWixDJwoEqd7VAg9Mel4gGYG8j3i4dFy0B15giHpWBpPaB4ue82 FsyUlG6gmmshiTT6aaNp+iOdhBuJkUi9bcJhW+A3vBzEbhqbAO0hUo1z/PvBJuSpmuDp sesA== X-Gm-Message-State: AKwxytfAPyQiBShajNgPKPffapoCuwF6wswN0ljmweIB6KQycTrgHUJO XUWNtVE4J19rT1H2f4PMoIstdg== X-Received: by 10.25.168.141 with SMTP id r135mr18349666lfe.80.1517352129488; Tue, 30 Jan 2018 14:42:09 -0800 (PST) Received: from localhost.localdomain (ppp109-252-108-121.pppoe.spdop.ru. [109.252.108.121]) by smtp.gmail.com with ESMTPSA id 4sm2938194lja.20.2018.01.30.14.42.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 14:42:08 -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 v2 2/2] MIPS: use generic GCC library routines from lib/ Date: Wed, 31 Jan 2018 01:42:02 +0300 Message-Id: <20180130224202.7682-3-antonynpavlov@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180130224202.7682-1-antonynpavlov@gmail.com> References: <20180130224202.7682-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..6f786d576dd2 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_CMPDI2 + select GENERIC_LSHRDI3 + 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); -- 2.11.0