diff options
author | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2020-05-29 13:01:04 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2020-05-29 13:01:04 +0100 |
commit | 304137d841407370a5b7f22fde75300102a9a033 (patch) | |
tree | 9b26f31ca9f29b7830339e0c09b9cdb1b7db18d2 /string/aarch64 | |
parent | 27bb6b2b4280648527c057a275ae001cbc76dc4b (diff) | |
download | arm-optimized-routines-304137d841407370a5b7f22fde75300102a9a033.tar.gz |
string: Fix issue in strcmp-mte
Ensure nul bytes before unaligned strings are correctly ignored.
Diffstat (limited to 'string/aarch64')
-rw-r--r-- | string/aarch64/strcmp-mte.S | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/string/aarch64/strcmp-mte.S b/string/aarch64/strcmp-mte.S index 16cae26..8f2abc4 100644 --- a/string/aarch64/strcmp-mte.S +++ b/string/aarch64/strcmp-mte.S @@ -99,12 +99,6 @@ L(end): sub result, data1, data2, lsr 56 ret -L(done): - sub result, data1, data2 - ret - - .p2align 4 - L(mutual_align): /* Sources are mutually aligned, but are not currently at an alignment boundary. Round down the addresses and then mask off @@ -113,13 +107,12 @@ L(mutual_align): ldr data2, [src1, off2] ldr data1, [src1], 8 neg shift, src2, lsl 3 /* Bits to alignment -64. */ - LS_FW tmp, zeroones, shift + mov tmp, -1 + LS_FW tmp, tmp, shift orr data1, data1, tmp orr data2, data2, tmp b L(start_realigned) - .p2align 4 - L(misaligned8): /* Align SRC1 to 8 bytes and then compare 8 bytes at a time, always checking to make sure that we don't access beyond the end of SRC2. */ @@ -142,8 +135,9 @@ L(src1_aligned): #endif sub has_nul, data3, zeroones orr tmp, data3, REP8_7f - bics has_nul, has_nul, tmp - b.ne L(tail) + bic has_nul, has_nul, tmp + lsr tmp, has_nul, shift + cbnz tmp, L(tail) sub off1, src2, src1 @@ -182,5 +176,10 @@ L(tail): orr syndrome, diff, has_nul b L(end) +L(done): + sub result, data1, data2 + ret + + END (__strcmp_aarch64_mte) |