Skip to content

Instantly share code, notes, and snippets.

@kumpera
Created August 30, 2013 23:58
Show Gist options
  • Select an option

  • Save kumpera/6395353 to your computer and use it in GitHub Desktop.

Select an option

Save kumpera/6395353 to your computer and use it in GitHub Desktop.
InterlockedCompareExchange64:
@ args = 8, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
stmfd sp!, {r4, r5, r6, r7}
ldrd r4, [sp, #16]
dmb sy
.L2:
ldrexd r6, r7, [r0]
cmp r7, r5
it eq
cmpeq r6, r4
bne .L3
strexd r1, r2, r3, [r0]
cmp r1, #0
bne .L2
.L3:
dmb sy
mov r0, r6
mov r1, r7
ldmfd sp!, {r4, r5, r6, r7}
bx lr
.size InterlockedCompareExchange64, .-InterlockedCompareExchange64
.align 2
.global InterlockedCompareExchangeClang
.type InterlockedCompareExchangeClang, %function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment