#17343 - DarkPhantom - Sat Mar 06, 2004 5:46 pm
Quick question since I can't find the answer in any of my ARM documentation. How costly are conditional instructions that don't execute? I mean do instructions that fail their conditional field still use the cycles that they would have had they executed? I'm just woundering where it becomes more desireable to use a branch as opposed to a block of conditional instructions.
For example, I wrote this "if else" block not that long ago:
orrs r8, r8, r8
mulne r12, r11, r1
addne r12, r12, r0, LSL #1
muleq r12, r11, r0
addeq r12, r12, r1, LSL #1
would that be more desireable than
orrs r8, r8, r8
beq else
mul r12, r11, r1
add r12, r12, r0, LSL #1
b endif
else:
mul r12, r11, r0
add r12, r12, r1, LSL #1
endif:
I think the first way is much easier to follow (when its commented). Of course, I'm one of those problem programmer's who wants to "conserve" labels. :P
_________________
"head straight for your goal by any means
there is a door that you've never opened
there is a window with a view you've never seen
get there no matter how long it takes"
-Theme of Shadow, Sonic Adventure 2
For example, I wrote this "if else" block not that long ago:
orrs r8, r8, r8
mulne r12, r11, r1
addne r12, r12, r0, LSL #1
muleq r12, r11, r0
addeq r12, r12, r1, LSL #1
would that be more desireable than
orrs r8, r8, r8
beq else
mul r12, r11, r1
add r12, r12, r0, LSL #1
b endif
else:
mul r12, r11, r0
add r12, r12, r1, LSL #1
endif:
I think the first way is much easier to follow (when its commented). Of course, I'm one of those problem programmer's who wants to "conserve" labels. :P
_________________
"head straight for your goal by any means
there is a door that you've never opened
there is a window with a view you've never seen
get there no matter how long it takes"
-Theme of Shadow, Sonic Adventure 2