Skip to content

Instantly share code, notes, and snippets.

@ssvb
Created January 19, 2016 15:16
Show Gist options
  • Select an option

  • Save ssvb/d0f40bf056742afb7ed9 to your computer and use it in GitHub Desktop.

Select an option

Save ssvb/d0f40bf056742afb7ed9 to your computer and use it in GitHub Desktop.
/* Usage: gcc -DCPU_CLOCK_FREQUENCY=1008000000 test.S && time ./a.out
*/
.cpu cortex-a53+fp+simd
.file "1.c"
.text
.align 2
.global main
.type main, %function
main:
#ifndef CPU_CLOCK_FREQUENCY
#error CPU_CLOCK_FREQUENCY must be defined
#endif
#define LOOP_UNROLL_FACTOR 30
sub sp, sp, #128
add x2, x2, #16
bic x2, x2, #15
add x3, x2, #64
ldr x1, =(CPU_CLOCK_FREQUENCY / LOOP_UNROLL_FACTOR)
b 1f
.balign 64
1:
.rept LOOP_UNROLL_FACTOR
add x2, x2, x2
.endr
subs x1, x1, #1
bne 1b
add sp, sp, #128
mov w0, 0
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment