Re: ARM EABI port: minimum CPU choice
> Is there any reason not to make ldm the default for armv4 and above,
> since it seems to win most, among the various options?
Because ldm (or ldr) require going via memory.
gcc will already use ldm/ldr in a function return if the function prologue if
the function prologue pushed the return address. The generated code looks
something like:
fn:
stmfd sp!, {regs, lr}
...(may modify lr)
ldmfd sp!, {regs, pc}
If the return address was not pushed (ie. a leaf function) it will use
mov pc, lr (v4) or bx lr (v4t+). eg:
fn:
... (does not modify lr)
mov pc, lr
Which is one instruction and two memory accesses shorter.
Interworked v4t is different again, but I'm going to ignore that. The only
difference between v4 and v4t is Thumb, and we've already agreed we can do
without Thumb on v4t.
Paul
Reply to: