84: Remove unnecessary branch instruction in crt0 r=Lokathor a=ketsuban

I noticed a while ago that the BEQ instruction wasn't actually doing anything because I forgot the difference between SUB and SUBS (the latter sets condition flags). Moreover, I don't need a BEQ in the first place since ARM instructions are inherently conditional; it's not a huge deal, but it improves performance for this early code because the pipeline stays nice and full.

Co-authored-by: Thomas Winwood <twwinwood@gmail.com>
This commit is contained in:
bors[bot] 2019-06-04 20:56:49 +00:00
commit f66ccba442

14
crt0.s
View file

@ -63,14 +63,14 @@ __start:
ldr r0, =__data_lma @ source address ldr r0, =__data_lma @ source address
ldr r1, =__data_start @ destination address ldr r1, =__data_start @ destination address
ldr r2, =__data_end ldr r2, =__data_end
sub r2, r2, r1 subs r2, r1 @ length
beq .Lskip @ don't try to copy an empty .data section @ these instructions are only executed if r2 is nonzero
add r2, #3 @ (i.e. don't bother copying an empty .data section)
mov r2, r2, asr #2 @ length (in words) addne r2, #3
add r2, #0x04000000 @ copy by words asrne r2, #2
swi 0xb0000 addne r2, #0x04000000
swine 0xb0000
.Lskip:
@ jump to user code @ jump to user code
ldr r0, =main ldr r0, =main
bx r0 bx r0