beagleboard 500MHz
Calls to either x(500000000), y(500000000) or z(500000000) take 6 seconds. So it's 6 cycles per loop iteration everywhere.
Checking for condition and branching in the next instruction seems to pair well?
This agrees with Cortex-A8 TRM:
"Conditional branches
Conditional branches are executed differently than other conditional instructions. Most
conditional instructions take the destination register as an additional source and the
condition codes are resolved in E2. Branches do not require the destination register, PC,
as an additional source because they already use the PC as a source. They are also
different than normal conditional operations because the flags resolve the condition
codes in E3 rather than E2. This enables the pairing of a flag setting instruction and a
branch in the same cycle."
///////////////////////////////////////
.text
.global x
.global y
.global z
x:
mov r1, #1
1:
add r0, r0, #0
add r0, r0, #0
cmp r1, #0
beq unreachable_label
add r0, r0, #0
add r0, r0, #0
subs r0, r0, #1
bgt 1b
bx lr
y:
mov r1, #1
1:
add r0, r0, #0
add r0, r0, #0
add r0, r0, #0
add r0, r0, #0
add r0, r0, #0
subs r0, r0, #1
bgt 1b
bx lr
z:
mov r1, #1
1:
add r0, r0, #0
add r0, r0, #0
subs r0, r0, #1
add r0, r0, #0
add r0, r0, #0
add r0, r0, #0
bgt 1b
bx lr