avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] SBI an CBI optimizations


From: Trampas
Subject: RE: [avr-gcc-list] SBI an CBI optimizations
Date: Thu, 7 Jul 2005 11:25:31 -0400

I gave that a shot:

#define DISABLE_INTO_ISR() {GIMSK &= ~(1<<INT0);}

176:rs485.c       ****  DISABLE_INTO_ISR();
 247                    .LM24:
 248 0086 8BB7                  in r24,91-0x20
 249 0088 8F7B                  andi r24,lo8(-65)
 250 008a 8BBF                  out 91-0x20,r24


Note that it appears to work on other registers:

95:rs485.c       ****   DDRD=DDRD & 0xFE;
 134                    .LM3:
 135 000c 8898                  cbi 49-0x20,0
  96:rs485.c       **** 
  97:rs485.c       ****         //set up PD1 (TX pin) as output
  98:rs485.c       ****         DDRD=DDRD | 0x02; 
 137                    .LM4:
 138 000e 899A                  sbi 49-0x20,1

Regards,
Trampas 
  
 

-----Original Message-----
From: Alex Wenger [mailto:address@hidden 
Sent: Thursday, July 07, 2005 11:03 AM
To: Trampas
Cc: address@hidden
Subject: Re: [avr-gcc-list] SBI an CBI optimizations

Hello,

Trampas schrieb:
> I am using WinAvr GCC 3.4.3 so this may have been fixed in 4.0, but I have
> noticed that the compiler does not optimize the following:
> 
> 
> #define DISABLE_INTO_ISR() {GIMSK=GIMSK & ~(1<<INT0);}
> 
> 176:rs485.c       ****        DISABLE_INTO_ISR();
>  247                  .LM24:
>  248 0086 8BB7                in r24,91-0x20
>  249 0088 8F7B                andi r24,lo8(-65)
>  250 008a 8BBF                out 91-0x20,r24
> 
> That is unless I am mistaken this can be done with a CBI instruction? 

no, when you write: GIMSK=GIMSK & ~(1<<INT0);
you mean read, modify, write.
you should write GIMSK &= ~(1<<INT0);
then it should work.

/Blueloop






reply via email to

[Prev in Thread] Current Thread [Next in Thread]