mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
libc/arm64: add cfi for optimized func
(gdb) bt
#0 arch_strlen () at machine/arm64/gnu/arch_strlen.S:119
#1 0x000000004043a2c0 in strchr (s=s@entry=0x408e5e40 "HELLO WORLD", c=c@entry=87) at machine/arch_libc.c:252
#2 0x0000000040504c6c in strchr (c=87, s=0x408e5e40 "HELLO WORLD") at /home/mi/ssd/dev-system/nuttx/include/string.h:306
#3 test_strchr () at hello_main.c:79
#4 hello_main (argc=argc@entry=1, argv=argv@entry=0x40b5c090) at hello_main.c:132
#5 0x000000004043d958 in nxtask_startup (entrypt=0x40504ba0 <hello_main>, argc=argc@entry=1, argv=argv@entry=0x40b5c090) at sched/task_startup.c:72
#6 0x00000000403f1ab4 in nxtask_start () at task/task_start.c:104
#7 0x0000000000000000 in ?? ()
Signed-off-by: yangao1 <yangao1@xiaomi.com>
This commit is contained in:
@@ -81,6 +81,8 @@
|
||||
.endm
|
||||
|
||||
def_fn ARCH_LIBCFUN(memchr)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
/* Do not dereference srcin if no bytes to compare. */
|
||||
cbz cntin, .Lzero_length
|
||||
/*
|
||||
@@ -174,6 +176,7 @@ def_fn ARCH_LIBCFUN(memchr)
|
||||
mov result, #0
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(memchr), . - ARCH_LIBCFUN(memchr)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,6 +95,8 @@
|
||||
.endm
|
||||
|
||||
def_fn ARCH_LIBCFUN(memcmp) p2align=6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
subs limit, limit, 8
|
||||
b.lo L(less8)
|
||||
|
||||
@@ -197,6 +199,7 @@ L(byte_loop):
|
||||
sub result, data1w, data2w
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(memcmp), . - ARCH_LIBCFUN(memcmp)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
*/
|
||||
|
||||
def_fn ARCH_LIBCFUN(memcpy) p2align=6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
prfm PLDL1KEEP, [src]
|
||||
add srcend, src, count
|
||||
add dstend, dstin, count
|
||||
@@ -233,6 +235,7 @@ L(copy_long):
|
||||
stp C_l, C_h, [dstend, -16]
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(memcpy), . - ARCH_LIBCFUN(memcpy)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -101,6 +101,8 @@
|
||||
*/
|
||||
|
||||
def_fn ARCH_LIBCFUN(memmove), 6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
sub tmp1, dstin, src
|
||||
cmp count, 96
|
||||
ccmp tmp1, count, 2, hi
|
||||
@@ -158,6 +160,7 @@ def_fn ARCH_LIBCFUN(memmove), 6
|
||||
stp C_l, C_h, [dstin]
|
||||
3: ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(memmove), . - ARCH_LIBCFUN(memmove)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
|
||||
def_fn ARCH_LIBCFUN(memset) p2align=6
|
||||
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
dup v0.16B, valw
|
||||
add dstend, dstin, count
|
||||
|
||||
@@ -243,6 +245,7 @@ L(zva_other):
|
||||
sub dst, dst, 32 /* Bias dst for tail loop. */
|
||||
b L(tail64)
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(memset), . - ARCH_LIBCFUN(memset)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -85,6 +85,8 @@
|
||||
.endm
|
||||
|
||||
def_fn ARCH_LIBCFUN(strchr)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
/* Magic constant 0x40100401 to allow us to identify which lane
|
||||
matches the requested byte. Magic constant 0x80200802 used
|
||||
similarly for NUL termination. */
|
||||
@@ -162,6 +164,7 @@ def_fn ARCH_LIBCFUN(strchr)
|
||||
csel result, result, xzr, eq
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strchr), . - ARCH_LIBCFUN(strchr)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
.endm
|
||||
|
||||
def_fn ARCH_LIBCFUN(strchrnul)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
/* Magic constant 0x40100401 to allow us to identify which lane
|
||||
matches the termination condition. */
|
||||
mov wtmp2, #0x0401
|
||||
@@ -147,6 +149,7 @@ def_fn ARCH_LIBCFUN(strchrnul)
|
||||
add result, src, tmp1, lsr #1
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strchrnul), . - ARCH_LIBCFUN(strchrnul)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
/* Start of performance-critical section -- one 64B cache line. */
|
||||
def_fn ARCH_LIBCFUN(strcmp) p2align=6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
eor tmp1, src1, src2
|
||||
mov zeroones, #REP8_01
|
||||
tst tmp1, #7
|
||||
@@ -206,6 +208,7 @@ L(loop_misaligned):
|
||||
L(done):
|
||||
sub result, data1, data2
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strcmp), .-ARCH_LIBCFUN(strcmp)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -108,6 +108,8 @@
|
||||
#define MIN_PAGE_SIZE (1 << MIN_PAGE_P2)
|
||||
|
||||
def_fn ARCH_LIBCFUN(strcpy) p2align=6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
/* For moderately short strings, the fastest way to do the copy is to
|
||||
calculate the length of the string in the same way as strlen, then
|
||||
essentially do a memcpy of the result. This avoids the need for
|
||||
@@ -321,6 +323,7 @@ def_fn ARCH_LIBCFUN(strcpy) p2align=6
|
||||
bic has_nul2, tmp3, tmp4
|
||||
b .Lfp_gt8
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strcpy), . - ARCH_LIBCFUN(strcpy)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -114,6 +114,8 @@
|
||||
boundary. */
|
||||
|
||||
def_fn ARCH_LIBCFUN(strlen) p2align=6
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
and tmp1, srcin, MIN_PAGE_SIZE - 1
|
||||
mov zeroones, REP8_01
|
||||
cmp tmp1, MIN_PAGE_SIZE - 16
|
||||
@@ -243,6 +245,7 @@ L(page_cross):
|
||||
csel data2, data2, tmp2, eq
|
||||
b L(page_cross_entry)
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strlen), . - ARCH_LIBCFUN(strlen)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -84,6 +84,8 @@
|
||||
nop /* Pad so that the loop below fits a cache line. */
|
||||
.endr
|
||||
def_fn ARCH_LIBCFUN(strncmp)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
cbz limit, .Lret0
|
||||
eor tmp1, src1, src2
|
||||
mov zeroones, #REP8_01
|
||||
@@ -295,6 +297,7 @@ def_fn ARCH_LIBCFUN(strncmp)
|
||||
.Lret0:
|
||||
mov result, #0
|
||||
ret
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strncmp), . - ARCH_LIBCFUN(strncmp)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,6 +87,8 @@
|
||||
ret
|
||||
|
||||
def_fn ARCH_LIBCFUN(strnlen)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
cbz limit, .Lhit_limit
|
||||
mov zeroones, #REP8_01
|
||||
bic src, srcin, #15
|
||||
@@ -189,6 +191,7 @@ def_fn ARCH_LIBCFUN(strnlen)
|
||||
csinv data1, data1, xzr, le
|
||||
csel data2, data2, data2a, le
|
||||
b .Lrealigned
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strnlen), . - .Lstart /* Include pre-padding in size. */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
.endm
|
||||
|
||||
def_fn ARCH_LIBCFUN(strrchr)
|
||||
.cfi_sections .debug_frame
|
||||
.cfi_startproc
|
||||
/* Magic constant 0x40100401 to allow us to identify which lane
|
||||
matches the requested byte. Magic constant 0x80200802 used
|
||||
similarly for NUL termination. */
|
||||
@@ -180,6 +182,7 @@ def_fn ARCH_LIBCFUN(strrchr)
|
||||
|
||||
ret
|
||||
|
||||
.cfi_endproc
|
||||
.size ARCH_LIBCFUN(strrchr), . - ARCH_LIBCFUN(strrchr)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user