I'm using Arduino 1.8.13 with avr-g++ (GCC) 7.3.0.
char x;
x >>= 5 generates asm (promoted to 16 bit signed) with 5* asr+ror;
x = x * (1<<(8-5)) / 256
generates 5* asr (without type promotion).
Kind regards,
Jochen
Weddington, Eric Mon, 08 Nov 2010 04:25:48 -0800
-----Original Message-----
From:
avr-gcc-list-bounces+eric.weddington=atmel....@nongnu.org
[mailto:avr-gcc-list-bounces+eric.weddington=atmel....@nongnu.
org] On Behalf Of William "Chops" Westfield
Sent: Sunday, November 07, 2010 9:58 PM
To: avr-gcc-list@nongnu.org
Subject: [avr-gcc-list] odd optimization differences of shift
between C andC++
Is this expected? Is it bug-worthy ?
I would say that it's bug-worthy, as a missed optimization bug. FYI, there are
more bugs with the C++ compiler for the AVR than for the C compiler. So I'm not
totally surprised that this is happening.
BTW, could you please subscribe to the mailing list? That way your posts do not
have to be approved by hand.
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list