Re: Inefficiencies in large integers

2013-08-18 Thread Asm Twiddler
Hello Oleg, On Sun, Aug 18, 2013 at 6:36 AM, Oleg Endo wrote: > On Sun, 2013-08-18 at 00:55 -0400, Asm Twiddler wrote: >> Hello all, >> >> I'm not sure whether this has been posted before, but gcc creates >> slightly inefficient code for large integers in several

Inefficiencies in large integers

2013-08-17 Thread Asm Twiddler
Hello all, I'm not sure whether this has been posted before, but gcc creates slightly inefficient code for large integers in several cases: unsigned long long val; void example1() { val += 0x8000ULL; } On x86 this results in the following assembly: addl $0, val adcl $32768, val+4 re

AVR-gcc shift optimization

2013-08-01 Thread Asm Twiddler
Hello all. The current implementation produces non-optimal code for large shifts that aren't a multiple of eight when operating on long integers (4 bytes). All such shifts are broken down into a slow loop shift. For example, a logical shift right by 17 will result in a loop that takes around 7 cyc