I tracked it down to the bit-test-instruction.
always when "bit #mask, &mem" or "bit.b #mask, &mem" is used, the compiler
assumes r15 to be altered.

Ralf


"Dmitry" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
oops...

well this may be because some register has been optimized out with a
peephole.

~d


On Thursday 21 August 2003 18:58, Ralf Guetlein wrote:
> Hi,
> I'm looking for the least time and memory consuming
> solution of an interrupt routine. I realized that there
> are useless register saves/restores when using bit
> manipulation. I broke it down to the examples below.
>
> By the way...
> In lack of a real-world application I used nonsensical
> interrupt vectors ("-1" and "-2", see below). The compiler
> answered with a really funny warning:
>
> "warning: Interrupt vector 0xffdf assigned
>    to ISR 'testint1' does make sense"
>
> ;-)
>
> Cheers,
> Ralf
>
>
>
> here the examples:
>
>
> the source lines:
> =================
>
> volatile int Counter;
>
> char fAdjust;
>
> interrupt (-2) testint2(void)
> {
>  if (fAdjust)
>     Counter++;
> }
>
> compile to:
> ===========
>
> interrupt (-2) testint2(void)
> {
>  if (fAdjust)
>    0: c2 93 00 00  cmp.b #0, &0x0000 ;r3 As==00
>    4: 02 24        jz $+6       ;abs 0xa
>     Counter++;
>    6: 92 53 00 00  inc &0x0000  ;
> }
>    a: 00 13        reti
>
> whereas the source lines:
> =========================
>
>  struct {
>   int Adjust: 1;
> } Flags;
>
> interrupt (-1) testint1(void)
> {
>  if (Flags.Adjust)
>     Counter++;
> }
>
> compile to:
> ===========
>
> interrupt (-1) testint1(void)
> {
>    c: 0f 12        push r15  ;
>  if (Flags.Adjust)
>    e: d2 b3 00 00  bit.b #1, &0x0000 ;r3 As==01
>   12: 02 24        jz $+6       ;abs 0x18
>     Counter++;
>   14: 92 53 00 00  inc &0x0000  ;
> }
>   18: 3f 41        pop r15  ;
>   1a: 00 13        reti
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
> at the same time. Free trial click
> here:http://www.vmware.com/wl/offer/358/0
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

-- 
/*****************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild     UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  State Polytechnical Univ.
      (_Y_.)'  ._   )  `._ `. ``-..-'   Radio-Physics Departament
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,  Russia
   (il),-''  (li),'  ((!.-'             +7 (812) 5403923, 5585314
 *****************************************************************/



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0





Reply via email to