Skip to content

Commit

Permalink
Merge branch 'cm-11.0' into stable/cm-11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Brint E. Kriebel committed Sep 3, 2014
2 parents efe2a91 + a6ec766 commit 107d1b9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 34 deletions.
2 changes: 0 additions & 2 deletions libc/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ libc_static_common_src_files += \
bionic/pthread_create.cpp \
bionic/pthread_key.cpp \

libc_common_src_files += \
bionic/memchr.c
endif # x86

ifeq ($(TARGET_ARCH),mips)
Expand Down
94 changes: 63 additions & 31 deletions libc/arch-arm/krait/bionic/memmove.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
Copyright (c) 2009-2013 The Linux Foundation. All rights reserved.
Copyright (c) 2009-2014 The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -84,7 +84,7 @@ _memmove_words:
.save {r0, lr}
cmp r2, #0
it ne
subsne r12, r0, r1
subsne r12, r0, r1 // Warning: do not combine these "it" blocks
it eq
bxeq lr
// memmove only if r1 < r0 < r1+r2
Expand All @@ -94,15 +94,28 @@ _memmove_words:
cmpge r12, r0
it le
ble memcpy
cmp r2, #63
ble .Lneon_b2f_smallcopy
cmp r2, #4
it le
ble .Lneon_b2f_smallcopy_loop
push {r0, lr}
add r0, r0, r2
add r1, r1, r2
cmp r2, #64
it ge
bge .Lneon_b2f_copy_64
cmp r2, #32
it ge
bge .Lneon_b2f_copy_32
cmp r2, #8
it ge
bge .Lneon_b2f_copy_8
b .Lneon_b2f_copy_1
.Lneon_b2f_copy_64:
mov r12, r2, lsr #6
add r0, r0, #32
add r1, r1, #32
cmp r12, #PLDTHRESH
it le
ble .Lneon_b2f_copy_64_loop_nopld
sub r12, #PLDOFFS
sub lr, r1, #(PLDOFFS)*PLDSIZE
Expand All @@ -116,6 +129,7 @@ _memmove_words:
subs r12, r12, #1
vst1.32 {q0, q1}, [r0]!
vst1.32 {q2, q3}, [r0]
it ne
bne .Lneon_b2f_copy_64_loop_outer
mov r12, #PLDOFFS
.Lneon_b2f_copy_64_loop_nopld:
Expand All @@ -126,62 +140,80 @@ _memmove_words:
subs r12, r12, #1
vst1.32 {q8, q9}, [r0]!
vst1.32 {q10, q11}, [r0]
it ne
bne .Lneon_b2f_copy_64_loop_nopld
ands r2, r2, #0x3f
it eq
beq .Lneon_memmove_done
sub r1, r1, #32
sub r0, r0, #32
cmp r2, #32
it lt
blt .Lneon_b2f_copy_8
.Lneon_b2f_copy_32:
sub r1, r1, #32
sub r0, r0, #32
vld1.32 {q0, q1}, [r1]
vst1.32 {q0, q1}, [r0]
ands r2, r2, #0x1f
it eq
beq .Lneon_memmove_done
.Lneon_b2f_copy_8:
movs r12, r2, lsr #0x3
it eq
beq .Lneon_b2f_copy_1
.Lneon_b2f_copy_8_loop:
sub r1, r1, #8
sub r0, r0, #8
vld1.32 {d0}, [r1]
subs r12, r12, #1
vst1.32 {d0}, [r0]
it ne
bne .Lneon_b2f_copy_8_loop
ands r2, r2, #0x7
beq .Lneon_memmove_done
.Lneon_b2f_copy_1:
sub r1, r1, r2
sub r0, r0, r2
ands r12, r2, #1
beq .Lneon_b2f_copy_halfword_loop
subs r2, r2, #1
ldrb r3, [r1, r2]
strb r3, [r0, r2]
beq .Lneon_memmove_done
.Lneon_b2f_copy_halfword_loop:
subs r2, r2, #2
ldrh r3, [r1, r2]
strh r3, [r0, r2]
bne .Lneon_b2f_copy_halfword_loop
movs r12, r2, lsl #29
itttt mi
submi r1, r1, #4
submi r0, r0, #4
ldrmi r3, [r1]
strmi r3, [r0]
movs r2, r2, lsl #31
itttt cs
subcs r1, r1, #2
subcs r0, r0, #2
ldrhcs r3, [r1]
strhcs r3, [r0]
itttt mi
submi r1, r1, #1
submi r0, r0, #1
ldrbmi r12, [r1]
strbmi r12, [r0]
.Lneon_memmove_done:
pop {r0, pc}
.Lneon_b2f_smallcopy:
ands r12, r2, #1
beq .Lneon_b2f_halfword_small_loop
subs r2, r2, #1
ldrb r3, [r1, r2]
strb r3, [r0, r2]
it eq
bxeq lr
.Lneon_b2f_halfword_small_loop:
subs r2, r2, #2
ldrh r3, [r1, r2]
strh r3, [r0, r2]
bne .Lneon_b2f_halfword_small_loop
.Lneon_b2f_smallcopy_loop:
// 4 bytes or less
add r1, r1, r2
add r0, r0, r2
movs r12, r2, lsl #29
itttt mi
submi r1, r1, #4
submi r0, r0, #4
ldrmi r3, [r1]
strmi r3, [r0]
movs r2, r2, lsl #31
itttt cs
subcs r1, r1, #2
subcs r0, r0, #2
ldrhcs r3, [r1]
strhcs r3, [r0]
itttt mi
submi r1, r1, #1
submi r0, r0, #1
ldrbmi r12, [r1]
strbmi r12, [r0]
bx lr
.cfi_endproc
.cfi_endproc
END(memmove)

3 changes: 2 additions & 1 deletion libc/include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ typedef __kernel_id_t id_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_key_t key_t;
typedef __kernel_mode_t mode_t;
typedef __kernel_nlink_t nlink_t;
#ifndef _OFF_T_DEFINED_
#define _OFF_T_DEFINED_
typedef __kernel_off_t off_t;
Expand All @@ -69,6 +68,8 @@ typedef loff_t off64_t; /* GLibc-specific */

typedef __kernel_pid_t pid_t;

typedef __nlink_t nlink_t;

/* while POSIX wants these in <sys/types.h>, we
* declare then in <pthread.h> instead */
#if 0
Expand Down

0 comments on commit 107d1b9

Please sign in to comment.