aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Do Nascimento <Victor.DoNascimento@arm.com>2022-07-04 15:28:03 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-07-04 15:28:03 +0100
commit94ed5b928a498bccb72d582156bf0f39c104a481 (patch)
tree9b74e3b253dffc9c19164334d9dab122f9e3d526
parent9776149753ec2d217ecd52c1786ac73548fed8d8 (diff)
downloadarm-optimized-routines-94ed5b928a498bccb72d582156bf0f39c104a481.tar.gz
string: simplify M-profile strlen PACBTI epilogue
Merge stack pop instructions prior to returning from function. This also introduces fixes to CFI offset calculations to reflect the register ordering on push and pop instructions, with the lowest-numbered register saved to the lowest memory address.
-rw-r--r--string/arm/strlen-armv6t2.S25
1 files changed, 17 insertions, 8 deletions
diff --git a/string/arm/strlen-armv6t2.S b/string/arm/strlen-armv6t2.S
index 5beaa7d..a981600 100644
--- a/string/arm/strlen-armv6t2.S
+++ b/string/arm/strlen-armv6t2.S
@@ -54,8 +54,8 @@ ENTRY (__strlen_armv6t2)
.save {r4, r5, ra_auth_code}
.cfi_def_cfa_offset 12
.cfi_offset 143, -4
- .cfi_offset 4, -8
- .cfi_offset 5, -12
+ .cfi_offset 5, -8
+ .cfi_offset 4, -12
#else
#if __ARM_FEATURE_BTI_DEFAULT
bti
@@ -63,8 +63,8 @@ ENTRY (__strlen_armv6t2)
push {r4, r5}
.save {r4, r5}
.cfi_def_cfa_offset 8
- .cfi_offset 4, -4
- .cfi_offset 5, -8
+ .cfi_offset 4, -8
+ .cfi_offset 5, -4
#endif /* __ARM_FEATURE_PAC_DEFAULT */
pld [srcin, #0]
bic src, srcin, #7
@@ -124,12 +124,21 @@ L(null_found):
rev data1a, data1a
#endif
clz data1a, data1a
- ldrd r4, r5, [sp], #8
+ add result, result, data1a, lsr #3 /* Bits -> Bytes. */
+#if __ARM_FEATURE_PAC_DEFAULT
+ pop {r4, r5, ip}
+ .cfi_restore 4
.cfi_restore 5
+ .cfi_restore 143
+ .cfi_def_cfa_offset 0
+ aut ip, lr, sp
+#else
+ ldrd r4, r5, [sp], #8
.cfi_restore 4
- .cfi_adjust_cfa_offset -8
- add result, result, data1a, lsr #3 /* Bits -> Bytes. */
- pacbti_epilogue
+ .cfi_restore 5
+ .cfi_def_cfa_offset 0
+#endif /* __ARM_FEATURE_PAC_DEFAULT */
+ bx lr
L(misaligned8):
ldrd data1a, data1b, [src]