Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » MSPGCC
  • » [Mspgcc-users] Why are interrupts disabled for hw multiply intrinsics? [RSS Feed]

#1 March 14, 2008 17:27:49

Norman D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] Why are interrupts disabled for hw multiply intrinsics?


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

Offline

#2 March 14, 2008 17:38:47

Ori I.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] Why are interrupts disabled for hw multiply intrinsics?


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 <norman.j.davis***@*mail.com>
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
> Mspgcc-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/mspgcc-users>

Offline

  • Root
  • » MSPGCC
  • » [Mspgcc-users] Why are interrupts disabled for hw multiply intrinsics? [RSS Feed]

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support