mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
sh: Use generic GCC library routines
The C implementations of __ashldi3(), __ashrdi3__(), and __lshrdi3() in arch/sh/lib/ are identical to the generic C implementations in lib/. Reduce duplication by switching SH to the generic versions. Update the include path in arch/sh/boot/compressed accordingly. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Link: https://lore.kernel.org/r/74dbe68dc8e2ffb6180092f73723fe21ab692c7a.1679566500.git.geert+renesas@glider.be Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
This commit is contained in:
committed by
John Paul Adrian Glaubitz
parent
2d60eca501
commit
8bc6666f13
@@ -21,6 +21,9 @@ config SUPERH
|
|||||||
select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
|
select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
|
||||||
select GENERIC_IDLE_POLL_SETUP
|
select GENERIC_IDLE_POLL_SETUP
|
||||||
select GENERIC_IRQ_SHOW
|
select GENERIC_IRQ_SHOW
|
||||||
|
select GENERIC_LIB_ASHLDI3
|
||||||
|
select GENERIC_LIB_ASHRDI3
|
||||||
|
select GENERIC_LIB_LSHRDI3
|
||||||
select GENERIC_PCI_IOMAP if PCI
|
select GENERIC_PCI_IOMAP if PCI
|
||||||
select GENERIC_SCHED_CLOCK
|
select GENERIC_SCHED_CLOCK
|
||||||
select GENERIC_SMP_IDLE_THREAD
|
select GENERIC_SMP_IDLE_THREAD
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#include "../../lib/ashldi3.c"
|
#include "../../../../lib/ashldi3.c"
|
||||||
|
@@ -7,9 +7,7 @@ lib-y = delay.o memmove.o memchr.o \
|
|||||||
checksum.o strlen.o div64.o div64-generic.o
|
checksum.o strlen.o div64.o div64-generic.o
|
||||||
|
|
||||||
# Extracted from libgcc
|
# Extracted from libgcc
|
||||||
obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
|
obj-y += movmem.o ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o udiv_qrnnd.o
|
||||||
ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \
|
|
||||||
udiv_qrnnd.o
|
|
||||||
|
|
||||||
udivsi3-y := udivsi3_i4i-Os.o
|
udivsi3-y := udivsi3_i4i-Os.o
|
||||||
|
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
#include "libgcc.h"
|
|
||||||
|
|
||||||
long long __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);
|
|
@@ -1,32 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
#include "libgcc.h"
|
|
||||||
|
|
||||||
long long __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);
|
|
@@ -1,30 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
#include "libgcc.h"
|
|
||||||
|
|
||||||
long long __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);
|
|
Reference in New Issue
Block a user