.text
.global _gcd
_gcd:
mov r0,#9
mov r1,#15
b loop
loop:
cmp r0,r1
beq stop
subhi r0,r1
bhi loop
subcc r1,r0
bcc loop
stop:
b stop
.end
用for循环实现1~100之间和5050
.text
.global _gcd
_gcd:
mov r0,#0x0
mov r1,#0x1
mov r2,#0x64
b loop
loop:
cmp r1,r2
bhi stop
add r0,r0,r1
add r1,#0x1
b loop
stop:
b stop
.end