Skip to content

Instantly share code, notes, and snippets.

@kylelk
Created May 7, 2015 03:17
Show Gist options
  • Save kylelk/0a6f5b9379f8996c1ba3 to your computer and use it in GitHub Desktop.
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
.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