A multiplication by utilizing the MAC unit
leads to following assembler listing

  c = a*b;
   4: 02 12        push r2  ;
   6: 32 c2        dint
   8: 03 43        nop
   a: 82 4c 32 01  mov r15, &0x0132 ;
   e: 82 4f 38 01  mov r14, &0x0138 ;
  12: 1f 42 3a 01  mov &0x013a,r15 ;0x013a
  16: 32 41        pop r2  ;
  18: 82 4f 00 00  mov r15, &0x0000 ;


Wouldn't it make sense to have a measure to avoid
the interrupt enable/disable sequence if one is sure
that his interrupts don't use multiplications?

Say, with a command line parameter -mnointmac?

If you need very tight code (e. g. fft), this would be
very helpful.

Optimal code would be:

mov     r15,    &0x0132
mov     r14,    &0x0138
mov     &0x013a,&0x0000

An even more sophisticated solution would be if an
intermediate 32bit result were held in the MAC
result register, and a "e = a*b + c*d" ended up
in the appropriate multiply/accumulate sequence.


Regards,
Ralf





Reply via email to