I guess it is done to make the multiplication an atomic operation so that
nothing can change any of the variables during the operation and thus create
wrong result.

-- 
Ori Idan

On Fri, Mar 14, 2008 at 6:27 PM, Norman Davis <[email protected]>
wrote:

> Hi everyone,
>
> For the following C language code:
>
>
>  long a, b, c;
>
>  b = 12345;
>  c = 54321;
>
>  a = b * c;
>
> I get the following assembler output in the .s file.
>
>  mov #llo(12345), 4(r4)
>  mov #lhi(12345), 4+2(r4)
>  mov #llo(54321), 8(r4)
>  mov #lhi(54321), 8+2(r4)
>  mov 4(r4), r10
>  mov 4+2(r4), r11
>  mov 8(r4), r12
>  mov 8+2(r4), r13
>  push r2
>  dint
>  call #__umulsi3hw
>  pop r2
>  mov r14, @r4
>  mov r15, 2(r4)
>
> It looks like the interrupts are being disabled around the call:
>
>  push r2                   ; store interrupt status (among other status)
>  dint                         ; disable interrupts
>  call #__umulsi3hw
>  pop r2                     ; restore previous interrupt status
>
> I'm curious what the purpose of this is. In my particular case, I know
> none of my interrupt routines (currently) use the hardware multiplier,
> so is there an option to disable this disabling? It might be adding a
> significant interrupt latency for my application.
>
> (I compiled this way:  msp430-gcc -S -mmcu=msp430x1611 main.c.)
>
> Norm
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

Reply via email to