Skip to contentSkip to conversation

MIPS: use generic GCC library routines from lib/

PATCH In review Antony Pavlov 5 participants 11 messages Jan 31, 2018 – Feb 17, 2018

Subsystems (3)
lore
Share & tools
lore
#2 lore raw

PATCH v3 2/2 MIPS: use generic GCC library routines from lib/

In reply to Antony Pavlov

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/.

---
 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(-)
arch/mips/Kconfig +5 -0
index 350a990fc719..b63a5422d485 100644
@@ -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
arch/mips/lib/Makefile +1 -1
index 78c2affeabf8..195ab4cb0840 100644
@@ -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
arch/mips/lib/ashldi3.c deleted +0 -30
deleted file mode 100644
index 24cd6903e797..000000000000
@@ -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);
arch/mips/lib/ashrdi3.c deleted +0 -32
deleted file mode 100644
index 23f5295af51e..000000000000
@@ -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);
arch/mips/lib/cmpdi2.c deleted +0 -28
deleted file mode 100644
index 93cfc785927d..000000000000
@@ -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);
arch/mips/lib/lshrdi3.c deleted +0 -30
deleted file mode 100644
index 914b971aca3b..000000000000
@@ -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);
arch/mips/lib/ucmpdi2.c deleted +0 -22
deleted file mode 100644
index c31c78ca4175..000000000000
@@ -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);
Signature · 1 line
2.15.1
#1 lore raw

PATCH v3 1/2 Add notrace to lib/ucmpdi2.c

In reply to Antony Pavlov

From: Palmer Dabbelt <[email protected]>

As part of the MIPS conversion to use the generic GCC library routines, Matt Redfearn discovered that I'd missed a notrace on __ucmpdi2(). This patch rectifies the problem.

---
 lib/ucmpdi2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ucmpdi2.c +1 -1
index 25ca2d4c1e19..597998169a96 100644
@@ -17,7 +17,7 @@
 #include <linux/module.h>
 #include <linux/libgcc.h>
 
-word_type __ucmpdi2(unsigned long long a, unsigned long long b)
+word_type notrace __ucmpdi2(unsigned long long a, unsigned long long b)
 {
 	const DWunion au = {.ll = a};
 	const DWunion bu = {.ll = b};
Signature · 1 line
2.15.1
#0 lore raw

v3 cover MIPS: use generic GCC library routines from lib/

Changes since v2 patch series (https://www.linux-mips.org/archives/linux-mips/2018-01/msg00567.html):

* sort the CONFIG_GENERIC_* options in arch/mips/Kconfig alphabetically (v2).

Changes since v1 patch series (https://www.linux-mips.org/archives/linux-mips/2018-01/msg00394.html):

* sort the CONFIG_* options in arch/mips/Kconfig alphabetically;
* add notrace to lib/ucmpdi2.c.

Antony Pavlov (1):
MIPS: use generic GCC library routines from lib/

Palmer Dabbelt (1):
Add notrace to lib/ucmpdi2.c

 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 ----------------------
 lib/ucmpdi2.c           |  2 +-
 8 files changed, 7 insertions(+), 144 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
Signature · 1 line
2.15.1
#3 lore raw
In reply to Antony Pavlov

Hi,

Quoted 42 lines · Antony Pavlov

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/.

---
  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(-)
arch/mips/Kconfig +3 -0
index 350a990fc719..b63a5422d485 100644
@@ -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

arch/mips/Kconfig config MIPS · line 38

Quoted 10 lines
arch/mips/Kconfig +2 -0
  	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

OK, thanks for changing this. But to be honest, it does look pretty messy like this. I feel like the CONFIG names should be something a little more descriptive, such as CONFIG_GENERIC_LIB_*, putting them in a namespace that would at least group them all together. Right now, AFAIK there's only RISC-V using these so it shouldn't be too painful to change them. What do you think Antony / Palmer?

Thanks,
Matt

Quoted 183 lines
arch/mips/lib/Makefile +1 -1
index 78c2affeabf8..195ab4cb0840 100644
@@ -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
arch/mips/lib/ashldi3.c deleted +0 -30
deleted file mode 100644
index 24cd6903e797..000000000000
@@ -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);
arch/mips/lib/ashrdi3.c deleted +0 -32
deleted file mode 100644
index 23f5295af51e..000000000000
@@ -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);
arch/mips/lib/cmpdi2.c deleted +0 -28
deleted file mode 100644
index 93cfc785927d..000000000000
@@ -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);
arch/mips/lib/lshrdi3.c deleted +0 -30
deleted file mode 100644
index 914b971aca3b..000000000000
@@ -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);
arch/mips/lib/ucmpdi2.c deleted +0 -22
deleted file mode 100644
index c31c78ca4175..000000000000
@@ -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);
#4 lore raw
Quoted 54 lines · On Wed, 31 Jan 2018 08:07:51 PST (-0800), [email protected] wrote:

Hi,

Quoted 51 lines · Antony Pavlov

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/.

---
  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(-)
arch/mips/Kconfig +5 -0
index 350a990fc719..b63a5422d485 100644
@@ -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
Quoted 8 lines

arch/mips/Kconfig config MIPS · line 38

Quoted 1 line
arch/mips/Kconfig +0 -0
  	select HAVE_ARCH_KGDB

OK, thanks for changing this. But to be honest, it does look pretty messy like this. I feel like the CONFIG names should be something a little more descriptive, such as CONFIG_GENERIC_LIB_*, putting them in a namespace that would at least group them all together. Right now, AFAIK there's only RISC-V using these so it shouldn't be too painful to change them. What do you think Antony / Palmer?

That looks good to me. It's a bit odd that they aren't all together.

Quoted 188 lines

Thanks,
Matt

Quoted 183 lines
arch/mips/lib/Makefile +1 -1
index 78c2affeabf8..195ab4cb0840 100644
@@ -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
arch/mips/lib/ashldi3.c deleted +0 -30
deleted file mode 100644
index 24cd6903e797..000000000000
@@ -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);
arch/mips/lib/ashrdi3.c deleted +0 -32
deleted file mode 100644
index 23f5295af51e..000000000000
@@ -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);
arch/mips/lib/cmpdi2.c deleted +0 -28
deleted file mode 100644
index 93cfc785927d..000000000000
@@ -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);
arch/mips/lib/lshrdi3.c deleted +0 -30
deleted file mode 100644
index 914b971aca3b..000000000000
@@ -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);
arch/mips/lib/ucmpdi2.c deleted +0 -22
deleted file mode 100644
index c31c78ca4175..000000000000
@@ -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);
#5 lore raw

PATCH 1/1 lib: Rename compiler intrinsic selects to GENERIC_LIB_*

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

---
 arch/riscv/Kconfig |  6 +++---
 lib/Kconfig        | 12 ++++++------
 lib/Makefile       | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
 	bool "RV32I"
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select 32BIT
-	select GENERIC_ASHLDI3
-	select GENERIC_ASHRDI3
-	select GENERIC_LSHRDI3
+	select GENERIC_LIB_ASHLDI3
+	select GENERIC_LIB_ASHRDI3
+	select GENERIC_LIB_LSHRDI3
 
 config ARCH_RV64I
 	bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
 endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
 	bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
 	bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
 	bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
 	bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
 	bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
 	bool
lib/Makefile +6 -6
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
 obj-$(CONFIG_PARMAN) += parman.o
 
 # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

Quoted 5 lines · Matt Redfearn

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

I don't remember who suggested that, if it wasn't you, please add Suggested-by tag with appropriate name.

Quoted 78 lines
---
 arch/riscv/Kconfig |  6 +++---
 lib/Kconfig        | 12 ++++++------
 lib/Makefile       | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
        bool "RV32I"
        select CPU_SUPPORTS_32BIT_KERNEL
        select 32BIT
-       select GENERIC_ASHLDI3
-       select GENERIC_ASHRDI3
-       select GENERIC_LSHRDI3
+       select GENERIC_LIB_ASHLDI3
+       select GENERIC_LIB_ASHRDI3
+       select GENERIC_LIB_LSHRDI3
 
 config ARCH_RV64I
        bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
 endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
        bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
        bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
        bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
        bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
        bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
        bool
lib/Makefile +6 -7
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
 obj-$(CONFIG_PARMAN) += parman.o
 
 # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
--

2.7.4

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

Hi Andy,

Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Matt Redfearn

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

I don't remember who suggested that, if it wasn't you, please add Suggested-by tag with appropriate name.

It was me that suggested the rename, before we ack replacing MIPS' compiler intrinsics with these generic ones.

Thanks,
Matt

Quoted 82 lines
Quoted 79 lines
---
  arch/riscv/Kconfig |  6 +++---
  lib/Kconfig        | 12 ++++++------
  lib/Makefile       | 12 ++++++------
  3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
         bool "RV32I"
         select CPU_SUPPORTS_32BIT_KERNEL
         select 32BIT
-       select GENERIC_ASHLDI3
-       select GENERIC_ASHRDI3
-       select GENERIC_LSHRDI3
+       select GENERIC_LIB_ASHLDI3
+       select GENERIC_LIB_ASHRDI3
+       select GENERIC_LIB_LSHRDI3
 
  config ARCH_RV64I
         bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
  endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
         bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
         bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
         bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
         bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
         bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
         bool
lib/Makefile +6 -7
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
  obj-$(CONFIG_PARMAN) += parman.o
 
  # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
--

2.7.4

Reviewed-by on v1 1/1
#8 lore raw

Re: [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

In reply to Matt Redfearn
Quoted 6 lines · On Fri, 09 Feb 2018 05:22:52 PST (-0800), [email protected] wrote:

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

Thanks! Do you want me to take this in my tree?

Quoted 74 lines
---
 arch/riscv/Kconfig |  6 +++---
 lib/Kconfig        | 12 ++++++------
 lib/Makefile       | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
 	bool "RV32I"
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select 32BIT
-	select GENERIC_ASHLDI3
-	select GENERIC_ASHRDI3
-	select GENERIC_LSHRDI3
+	select GENERIC_LIB_ASHLDI3
+	select GENERIC_LIB_ASHRDI3
+	select GENERIC_LIB_LSHRDI3
 
 config ARCH_RV64I
 	bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
 endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
 	bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
 	bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
 	bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
 	bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
 	bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
 	bool
lib/Makefile +6 -6
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
 obj-$(CONFIG_PARMAN) += parman.o
 
 # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
#9 lore raw

Re: [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

Quoted 11 lines · Palmer Dabbelt
Quoted 6 lines · On Fri, 09 Feb 2018 05:22:52 PST (-0800), [email protected] wrote:

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

Thanks! Do you want me to take this in my tree?

Since a new version of the "MIPS: use generic GCC library routines from lib/" series would depend on it, and it makes sense for that series to go via the MIPS tree, I think it would be simpler for this patch to also be taken (with your ack) via the MIPS tree. Is that okay?

Thanks
James

Quoted 75 lines
Quoted 75 lines
---
 arch/riscv/Kconfig |  6 +++---
 lib/Kconfig        | 12 ++++++------
 lib/Makefile       | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
 	bool "RV32I"
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select 32BIT
-	select GENERIC_ASHLDI3
-	select GENERIC_ASHRDI3
-	select GENERIC_LSHRDI3
+	select GENERIC_LIB_ASHLDI3
+	select GENERIC_LIB_ASHRDI3
+	select GENERIC_LIB_LSHRDI3
 
 config ARCH_RV64I
 	bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
 endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
 	bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
 	bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
 	bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
 	bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
 	bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
 	bool
lib/Makefile +6 -6
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
 obj-$(CONFIG_PARMAN) += parman.o
 
 # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
#10 lore raw

Re: [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*

Quoted 9 lines · On Tue, 13 Feb 2018 14:49:37 PST (-0800), [email protected] wrote:
Quoted 8 lines · Palmer Dabbelt
Quoted 6 lines · On Fri, 09 Feb 2018 05:22:52 PST (-0800), [email protected] wrote:

When these are included into arch Kconfig files, maintaining alphabetical ordering of the selects means these get split up. To allow for keeping things tidier and alphabetical, rename the selects to GENERIC_LIB_*

Quoted 8 lines
Quoted 3 lines

Thanks! Do you want me to take this in my tree?

Since a new version of the "MIPS: use generic GCC library routines from lib/" series would depend on it, and it makes sense for that series to go via the MIPS tree, I think it would be simpler for this patch to also be taken (with your ack) via the MIPS tree. Is that okay?

That's great, thanks!

Quoted 79 lines

Thanks
James

Quoted 75 lines
Quoted 75 lines
---
 arch/riscv/Kconfig |  6 +++---
 lib/Kconfig        | 12 ++++++------
 lib/Makefile       | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/Kconfig +3 -3
index 2c6adf12713a..5f1e2188d029 100644
@@ -99,9 +99,9 @@ config ARCH_RV32I
 	bool "RV32I"
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select 32BIT
-	select GENERIC_ASHLDI3
-	select GENERIC_ASHRDI3
-	select GENERIC_LSHRDI3
+	select GENERIC_LIB_ASHLDI3
+	select GENERIC_LIB_ASHRDI3
+	select GENERIC_LIB_LSHRDI3
 
 config ARCH_RV64I
 	bool "RV64I"
lib/Kconfig +6 -6
index c5e84fbcb30b..946d0890aad6 100644
@@ -584,20 +584,20 @@ config STRING_SELFTEST
 
 endmenu
 
-config GENERIC_ASHLDI3
+config GENERIC_LIB_ASHLDI3
 	bool
 
-config GENERIC_ASHRDI3
+config GENERIC_LIB_ASHRDI3
 	bool
 
-config GENERIC_LSHRDI3
+config GENERIC_LIB_LSHRDI3
 	bool
 
-config GENERIC_MULDI3
+config GENERIC_LIB_MULDI3
 	bool
 
-config GENERIC_CMPDI2
+config GENERIC_LIB_CMPDI2
 	bool
 
-config GENERIC_UCMPDI2
+config GENERIC_LIB_UCMPDI2
 	bool
lib/Makefile +6 -6
index d11c48ec8ffd..7e1ef77e86a3 100644
@@ -252,9 +252,9 @@ obj-$(CONFIG_SBITMAP) += sbitmap.o
 obj-$(CONFIG_PARMAN) += parman.o
 
 # GCC library routines
-obj-$(CONFIG_GENERIC_ASHLDI3) += ashldi3.o
-obj-$(CONFIG_GENERIC_ASHRDI3) += ashrdi3.o
-obj-$(CONFIG_GENERIC_LSHRDI3) += lshrdi3.o
-obj-$(CONFIG_GENERIC_MULDI3) += muldi3.o
-obj-$(CONFIG_GENERIC_CMPDI2) += cmpdi2.o
-obj-$(CONFIG_GENERIC_UCMPDI2) += ucmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
+obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
+obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o