[avr-gcc-list] Re: loop deleted using optimization

2007-03-06 Thread Ben Jackson
an empty asm, as long as you used the __volatile attribute to scare gcc away from reordering code in the loop. So, for () { __asm __volatile () ; } (I note I wasn't able to get gcc 3.3 to optimize away the loop on i386) -- Ben Jackson AD7GD [EMAIL PROTECTED] http://www.ben.com

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Ben Jackson
void change() { var = 1; } That's a shift, not a rotation, so var is going to become 0. while (1) { int var=1; while (var != 0) { PORTB = var; var = 1; } } Also, 'int var' is going to be 16 bits wide, so in this version which rotates the bit it's going to

Re: [avr-gcc-list] multiply by constant always expands to int

2005-12-06 Thread Ben Jackson
__mulqi3, else __mulhi3 You can probably also just move the literal '20' in for y; -- Ben Jackson [EMAIL PROTECTED] http://www.ben.com/ ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

[avr-gcc-list] multiply by constant always expands to int

2005-12-03 Thread Ben Jackson
of the development going on now, 3.x or 4.x? I guess I need to buckle down and read the gcc internals docs and start submitting patches. -- Ben Jackson [EMAIL PROTECTED] http://www.ben.com/ ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http

[avr-gcc-list] Saving space in interrupt handler prologues

2005-08-19 Thread Ben Jackson
the re-ordering of the memory accesses. -- Ben Jackson [EMAIL PROTECTED] http://www.ben.com/ ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

[avr-gcc-list] Zeroing longs: use memset for -Os?

2005-07-29 Thread Ben Jackson
Due to the size of sts instructions, it's actually fewer bytes to memset(somelong, 0, sizeof(long)). The memset is 12 bytes (count, hi, lo, sts, dec, loop, all 2 bytes) vs 16 for 4 straight sts's. If you're doing more than one variable of course the savings are bigger. -- Ben Jackson [EMAIL

[avr-gcc-list] Shift by multiple of 8 is really shifting...

2005-07-29 Thread Ben Jackson
eor r19, r19 c4: 22 27 eor r18, r18 -- Ben Jackson [EMAIL PROTECTED] http://www.ben.com/ ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

[avr-gcc-list] Don't use gcc 3.4.4, use 4.0.1

2005-07-28 Thread Ben Jackson
welcome dissenting opinions, but I wanted to put the recommendation out there for any other newbies. -- Ben Jackson [EMAIL PROTECTED] http://www.ben.com/ ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc

[avr-gcc-list] Should -mtiny-stack be the default for small devices?

2005-07-28 Thread Ben Jackson
The AT90S2313, for example, has only 128 bytes of memory. Is there any reason why -mtiny-stack shouldn't be the default for these devices? Looks like there are half a dozen ATtiny devices with 0 and =256 bytes of SRAM and several of the old AT90S* devices. -- Ben Jackson [EMAIL PROTECTED] http