Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix valgrind: Operate only in little endian #5

Merged
merged 1 commit into from
Sep 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions memcmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
memcmp_trailing_15bytes unaligned
199: /* Reached end without detecting a difference */
mov a1, #0
setend le
pop {DAT1-DAT6, pc}
.endm

Expand All @@ -180,7 +179,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
memcmp_trailing_15bytes unaligned
199: /* Reached end without detecting a difference */
mov a1, #0
setend le
pop {DAT1-DAT6, pc}
.endm

Expand Down Expand Up @@ -211,7 +209,6 @@ myfunc memcmp
OFF .req lr

push {DAT1-DAT6, lr}
setend be /* lowest-addressed bytes are most significant */

/* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */
cmp N, #(prefetch_distance+3)*32 - 1
Expand Down Expand Up @@ -264,9 +261,22 @@ myfunc memcmp
140: memcmp_short_inner_loop 1

200: /* Difference found: determine sign. */
rev DAT0, DAT0
rev DAT4, DAT4
rev DAT1, DAT1
rev DAT5, DAT5
rev DAT2, DAT2
rev DAT6, DAT6
rev DAT3, DAT3
rev DAT7, DAT7

cmp DAT0, DAT4
cmpeq DAT1, DAT5
cmpeq DAT2, DAT6
cmpeq DAT3, DAT7

movhi a1, #1
movlo a1, #-1
setend le
pop {DAT1-DAT6, pc}

.unreq S_1
Expand Down