From 7e841ed688947855a3bd20d2b23a44599257038a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 3 Oct 2013 23:30:33 -0700 Subject: [PATCH] Remove useless x86 fallbacks. The NDK ABI requires that you support SSE2, and the build system won't let you build with ARCH_X86_HAVE_SSE2 set to false. So let's stop pretending this constant is actually a variable, and let's remove the corresponding dead code. Also, the USE_SSE2 and USE_SSE3 macros are unused, so let's not bother setting them. Change-Id: I40b501d998530d22518ce1c4d14575513a8125bb --- libc/Android.mk | 33 ++++++++------------- libc/arch-x86/string/bzero.S | 44 --------------------------- libc/arch-x86/string/memset.S | 56 ----------------------------------- libc/arch-x86/string/strlen.S | 21 ------------- libc/arch-x86/x86.mk | 19 +----------- 5 files changed, 14 insertions(+), 159 deletions(-) delete mode 100644 libc/arch-x86/string/bzero.S delete mode 100644 libc/arch-x86/string/memset.S delete mode 100644 libc/arch-x86/string/strlen.S diff --git a/libc/Android.mk b/libc/Android.mk index a16a8155e..7fec14fca 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -579,26 +579,7 @@ ifeq ($(TARGET_ARCH),arm) libc_common_cflags += -DSOFTFLOAT libc_common_cflags += -fstrict-aliasing libc_crt_target_cflags := -mthumb-interwork -endif # !arm - -ifeq ($(TARGET_ARCH),x86) - libc_crt_target_cflags := -m32 - libc_crt_target_ldflags := -melf_i386 -endif -ifeq ($(TARGET_ARCH),x86_64) - libc_crt_target_cflags := -m64 - libc_crt_target_ldflags := -melf_x86_64 -endif - -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) - libc_common_cflags += -DSOFTFLOAT - ifeq ($(ARCH_X86_HAVE_SSE2),true) - libc_crt_target_cflags += -DUSE_SSE2=1 - endif - ifeq ($(ARCH_X86_HAVE_SSSE3),true) - libc_crt_target_cflags += -DUSE_SSSE3=1 - endif -endif +endif # arm ifeq ($(TARGET_ARCH),mips) ifneq ($(ARCH_MIPS_HAS_FPU),true) @@ -608,6 +589,18 @@ ifeq ($(TARGET_ARCH),mips) libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS) endif # mips +ifeq ($(TARGET_ARCH),x86) + libc_common_cflags += -DSOFTFLOAT + libc_crt_target_cflags := -m32 + libc_crt_target_ldflags := -melf_i386 +endif # x86 + +ifeq ($(TARGET_ARCH),x86_64) + libc_common_cflags += -DSOFTFLOAT + libc_crt_target_cflags := -m64 + libc_crt_target_ldflags := -melf_x86_64 +endif # x86_64 + # Define ANDROID_SMP appropriately. ifeq ($(TARGET_CPU_SMP),true) libc_common_cflags += -DANDROID_SMP=1 diff --git a/libc/arch-x86/string/bzero.S b/libc/arch-x86/string/bzero.S deleted file mode 100644 index c73a3511a..000000000 --- a/libc/arch-x86/string/bzero.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: bzero.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(bzero) - pushl %edi - movl 8(%esp),%edi - movl 12(%esp),%edx - - cld /* set fill direction forward */ - xorl %eax,%eax /* set fill data to 0 */ - - /* - * if the string is too short, it's really not worth the overhead - * of aligning to word boundries, etc. So we jump to a plain - * unaligned set. - */ - cmpl $16,%edx - jb L1 - - movl %edi,%ecx /* compute misalignment */ - negl %ecx - andl $3,%ecx - subl %ecx,%edx - rep /* zero until word aligned */ - stosb - - movl %edx,%ecx /* zero by words */ - shrl $2,%ecx - andl $3,%edx - rep - stosl - -L1: movl %edx,%ecx /* zero remainder by bytes */ - rep - stosb - - popl %edi - ret -END(bzero) diff --git a/libc/arch-x86/string/memset.S b/libc/arch-x86/string/memset.S deleted file mode 100644 index 62e6a173c..000000000 --- a/libc/arch-x86/string/memset.S +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: memset.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(memset) - pushl %edi - pushl %ebx - movl 12(%esp),%edi - movzbl 16(%esp),%eax /* unsigned char, zero extend */ - movl 20(%esp),%ecx - pushl %edi /* push address of buffer */ - - cld /* set fill direction forward */ - - /* - * if the string is too short, it's really not worth the overhead - * of aligning to word boundries, etc. So we jump to a plain - * unaligned set. - */ - cmpl $0x0f,%ecx - jle L1 - - movb %al,%ah /* copy char to all bytes in word */ - movl %eax,%edx - sall $16,%eax - orl %edx,%eax - - movl %edi,%edx /* compute misalignment */ - negl %edx - andl $3,%edx - movl %ecx,%ebx - subl %edx,%ebx - - movl %edx,%ecx /* set until word aligned */ - rep - stosb - - movl %ebx,%ecx - shrl $2,%ecx /* set by words */ - rep - stosl - - movl %ebx,%ecx /* set remainder by bytes */ - andl $3,%ecx -L1: rep - stosb - - popl %eax /* pop address of buffer */ - popl %ebx - popl %edi - ret -END(memset) diff --git a/libc/arch-x86/string/strlen.S b/libc/arch-x86/string/strlen.S deleted file mode 100644 index 527e36ac3..000000000 --- a/libc/arch-x86/string/strlen.S +++ /dev/null @@ -1,21 +0,0 @@ -/* $OpenBSD: strlen.S,v 1.3 2005/08/07 11:30:38 espie Exp $ */ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(strlen) - pushl %edi - movl 8(%esp),%edi /* string address */ - cld /* set search forward */ - xorl %eax,%eax /* set search for null terminator */ - movl $-1,%ecx /* set search for lots of characters */ - repne /* search! */ - scasb - notl %ecx /* get length by taking complement */ - leal -1(%ecx),%eax /* and subtracting one */ - popl %edi - ret -END(strlen) diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk index ada5d6987..395f0d4f9 100644 --- a/libc/arch-x86/x86.mk +++ b/libc/arch-x86/x86.mk @@ -50,7 +50,6 @@ _LIBC_ARCH_COMMON_SRC_FILES += \ upstream-freebsd/lib/libc/string/wmemcmp.c endif -ifeq ($(ARCH_X86_HAVE_SSE2),true) _LIBC_ARCH_COMMON_SRC_FILES += \ arch-x86/string/sse2-memset-atom.S \ arch-x86/string/sse2-bzero-atom.S \ @@ -64,23 +63,7 @@ _LIBC_ARCH_COMMON_SRC_FILES += \ arch-x86/string/sse2-wcschr-atom.S \ arch-x86/string/sse2-wcsrchr-atom.S \ arch-x86/string/sse2-wcslen-atom.S \ - arch-x86/string/sse2-wcscmp-atom.S -else -_LIBC_ARCH_COMMON_SRC_FILES += \ - arch-x86/string/memset.S \ - arch-x86/string/strlen.S \ - arch-x86/string/bzero.S \ - bionic/memrchr.c \ - bionic/memchr.c \ - bionic/strchr.cpp \ - string/strrchr.c \ - string/index.c \ - bionic/strnlen.c \ - upstream-freebsd/lib/libc/string/wcschr.c \ - upstream-freebsd/lib/libc/string/wcsrchr.c \ - upstream-freebsd/lib/libc/string/wcslen.c \ - upstream-freebsd/lib/libc/string/wcscmp.c -endif + arch-x86/string/sse2-wcscmp-atom.S \ _LIBC_ARCH_STATIC_SRC_FILES := \ bionic/dl_iterate_phdr_static.c \