Page 1 of 1

Arm Assembly help for IPAQ HELP PLEASE!!

PostPosted: Sep 18, 2003 @ 11:57pm
by mcrah
I am in serious need of some ARM Assembly help for the IPAQ.
I am trying to pass two floating point values from C to asm and add them, but I am obviously missing something.

If I write it in C and look at the generated asm code it loads the values in r0 and r1 then calls a section of the processor returning the result...

ldr r0, [sp, #8]
ldr r1, [sp, #0xC]
ldr r3, [pc, #0x10] ;where is this?
ldr r2, [r3]
mov lr, pc
mov pc, r2 ;call elsewhere. but where?
str r0, [sp, #8]

I really need this to be in assembly since it is an important part of a larger routine that needs speed.

If someone could help I would be very gratefull.
Examples with explanations would be perfect.

thanks
:?

PostPosted: Sep 19, 2003 @ 2:35am
by Dan East

PostPosted: Sep 19, 2003 @ 12:41pm
by refractor

Thanks

PostPosted: Sep 19, 2003 @ 3:51pm
by mcrah
Thanks guys for the responses.

Actually last night I figured it out.
The compiler stores an unreachable asm instruction near the routine itself, which evaluates to a pointer to what must be the FP table or in-processor fp-emulator.

ldr r3, [pc, #0x10] ;where is this?
ldr r2, [r3]
mov lr, pc
mov pc, r2 ;call elsewhere. but where?

this I understood as a setup for a call, but was unclear where the call was being made to.

now I know it is made to what the unreachable instruction evaluates to.

I can now mimic this in my own asm code, and get correct floating point results.

As for the optimization, the routine is highly optimized in asm and now runs approximately 20 times faster than its C++ counterpart.

The floating point calculation is just a very small(but integral) piece that is performed on pre-calculated values.

Since it is called many thousand times, it had to go to asm.

Thanks again for the comments, I appreciate the help.

McRah :D

PostPosted: Sep 19, 2003 @ 5:30pm
by simonjacobs

PostPosted: Sep 19, 2003 @ 6:07pm
by Kzinti

PostPosted: Sep 19, 2003 @ 9:15pm
by StephC

PostPosted: Sep 19, 2003 @ 10:09pm
by Kzinti