OSDN Git Service

MIPS: Use generic GCC library routines from lib/
authorAntony Pavlov <antonynpavlov@gmail.com>
Wed, 11 Apr 2018 07:50:19 +0000 (08:50 +0100)
committerJames Hogan <jhogan@kernel.org>
Mon, 23 Apr 2018 15:39:37 +0000 (16:39 +0100)
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 <antonynpavlov@gmail.com>
[Matt Redfearn] Use GENERIC_LIB_* named Kconfig entries
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/19051/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/Kconfig
arch/mips/lib/Makefile
arch/mips/lib/ashldi3.c [deleted file]
arch/mips/lib/ashrdi3.c [deleted file]
arch/mips/lib/cmpdi2.c [deleted file]
arch/mips/lib/lshrdi3.c [deleted file]
arch/mips/lib/ucmpdi2.c [deleted file]

index 225c95d..79a864c 100644 (file)
@@ -22,6 +22,11 @@ config MIPS
        select GENERIC_CPU_AUTOPROBE
        select GENERIC_IRQ_PROBE
        select GENERIC_IRQ_SHOW
+       select GENERIC_LIB_ASHLDI3
+       select GENERIC_LIB_ASHRDI3
+       select GENERIC_LIB_CMPDI2
+       select GENERIC_LIB_LSHRDI3
+       select GENERIC_LIB_UCMPDI2
        select GENERIC_PCI_IOMAP
        select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
        select GENERIC_SMP_IDLE_THREAD
index e84e126..6537e02 100644 (file)
@@ -16,5 +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 multi3.o \
-        ucmpdi2.o
+obj-y += bswapsi.o bswapdi.o multi3.o
diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
deleted file mode 100644 (file)
index 24cd690..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
-
-#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 (file)
index 23f5295..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
-
-#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 (file)
index 93cfc78..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
-
-#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 (file)
index 914b971..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
-
-#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 (file)
index c31c78c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
-
-#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);