Skip to content

Commit

Permalink
test: ARM Assembly syntax test file
Browse files Browse the repository at this point in the history
  • Loading branch information
starsep authored and sharkdp committed Oct 5, 2020
1 parent 3aabed4 commit db3468a
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
55 changes: 55 additions & 0 deletions tests/syntax-tests/highlighted/ARM Assembly/test.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.data

.balign 4
red: .word 0
green: .word 0
blue: .word 0

.text
.global grayscale
.func grayscale

grayscale:
assign:
 /* some comment */
 ldr ip, addr_red
 str r3, [ip]
 ldr ip, addr_green
 ldmfd r13!, {r3}
 str r3, [ip]
 ldr ip, addr_blue
 ldmfd r13!, {r3}
 str r3, [ip]
 stmfd r13!, {r4-r8}
 ldr ip, addr_red
 ldr r3, [ip]
 ldr ip, addr_green
 ldr r4, [ip]
 ldr ip, addr_blue
 ldr r5, [ip] /* another comment */
grayscale_loop:
 ldrb r6, [r1]
 mul r6, r3, r6
 add r1, r1, #1
 ldrb r7, [r1]
 mul r7, r4, r7
 add r1, r1, #1
 ldrb r8, [r1]
 mul r8, r5, r8
 add r1, r1, #1
 add r6, r6, r7
 add r6, r6, r8
 asr r6, r6, #8
 str r6, [r2]
 add r2, r2, #1
 sub r0, r0, #1
 cmp r0, #0
 bne grayscale_loop
 ldmfd r13!, {r4-r8}
 stmfd r13!, {r0-r1}
 bx lr

addr_red: .word red
addr_green: .word green
addr_blue: .word blue

55 changes: 55 additions & 0 deletions tests/syntax-tests/source/ARM Assembly/test.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.data

.balign 4
red: .word 0
green: .word 0
blue: .word 0

.text
.global grayscale
.func grayscale

grayscale:
assign:
/* some comment */
ldr ip, addr_red
str r3, [ip]
ldr ip, addr_green
ldmfd r13!, {r3}
str r3, [ip]
ldr ip, addr_blue
ldmfd r13!, {r3}
str r3, [ip]
stmfd r13!, {r4-r8}
ldr ip, addr_red
ldr r3, [ip]
ldr ip, addr_green
ldr r4, [ip]
ldr ip, addr_blue
ldr r5, [ip] /* another comment */
grayscale_loop:
ldrb r6, [r1]
mul r6, r3, r6
add r1, r1, #1
ldrb r7, [r1]
mul r7, r4, r7
add r1, r1, #1
ldrb r8, [r1]
mul r8, r5, r8
add r1, r1, #1
add r6, r6, r7
add r6, r6, r8
asr r6, r6, #8
str r6, [r2]
add r2, r2, #1
sub r0, r0, #1
cmp r0, #0
bne grayscale_loop
ldmfd r13!, {r4-r8}
stmfd r13!, {r0-r1}
bx lr

addr_red: .word red
addr_green: .word green
addr_blue: .word blue

0 comments on commit db3468a

Please sign in to comment.