Created
May 7, 2015 03:17
-
-
Save kylelk/0a6f5b9379f8996c1ba3 to your computer and use it in GitHub Desktop.
ARM assembly population count using NEON instructions. compile with: gcc -mfpu=neon pop_count.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global main | |
main: | |
ldr r0, =value | |
ldr r0, [r0] | |
vmov.32 d0[0], r0 | |
vcnt.8 d0, d0 | |
vmov.32 r0, d0[0] | |
add r0, r0, r0, lsr #16 | |
add r0, r0, r0, lsr #8 | |
and r0, r0, #31 | |
mov r1, r0 | |
ldr r0, =numberFormat | |
bl printf | |
mov r7, #1 | |
swi 0 | |
.data | |
numberFormat: .asciz "%d\n" | |
value: .word 123456 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment