Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: 32 bit Division

2004-09-07 by Peter

--- In lpc2000@yahoogroups.com, Frank Sergeant <frank@p...> wrote:
<snip>

> Also, see the question in the code in case anyone knows a way to 
reduce
> the two instructions to just one, repeated here:
> 
>          @mov  r1, r1, rol #1    @ this is what we'd like to do
>          mov r1, r1, lsl #1      @   but we accomplish it with 
these
>          adc r1, r1, #0          @   two instructions.  Is there a
>                                  @   way to do it in just one?
> 

Unfortunately, the immediate and the shifted register have to come 
out on the same register read port in ARM7.

An alternative is to hold zero in another register (for example R12) 
and do this:

    adc r1, r12, r1, lsl #1    @ R12 contains zero 

The added speed *may* be worth the cost of tying up a register. R12 
is allowed to be corrupted during a function call so it doesn't have 
to be stacked.

Peter.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.