[Bug target/49446] avr-g++ does not optimize when using bitshift in inlined function

2011-06-18 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

HotHead gcc at emailgo dot de changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
Version|4.6.0   |4.7.0
 Resolution|DUPLICATE   |

--- Comment #3 from HotHead gcc at emailgo dot de 2011-06-18 20:17:19 UTC ---
Seems that it is no duplicate.

additional files

test.ii (intermediate)  http://pastebin.com/ZPV521si
test.s (output)   http://pastebin.com/DDFW0FCU

compiler-output (verbose) http://pastebin.com/XHNPB6WX


[Bug target/49446] avr-g++ does not optimize when using bitshift in inlined function

2011-06-18 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

--- Comment #5 from HotHead gcc at emailgo dot de 2011-06-18 20:19:07 UTC ---
Created attachment 24557
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24557
intermediate file


[Bug target/49446] avr-g++ does not optimize when using bitshift in inlined function

2011-06-18 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

--- Comment #4 from HotHead gcc at emailgo dot de 2011-06-18 20:18:48 UTC ---
Created attachment 24556
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24556
output assembly, notice the unnecessary bitshifts


[Bug target/49446] avr-g++ does not optimize when using bitshift in inlined function

2011-06-18 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

--- Comment #6 from HotHead gcc at emailgo dot de 2011-06-18 20:19:56 UTC ---
compiler output with gcc-4.7.0 : http://pastebin.com/XHNPB6WX


[Bug target/33049] [avr] bit extraction non optimal, inversing logic solves problem

2011-06-17 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33049

HotHead gcc at emailgo dot de changed:

   What|Removed |Added

 CC||gcc at emailgo dot de

--- Comment #15 from HotHead gcc at emailgo dot de 2011-06-17 21:38:20 UTC ---
*** Bug 49446 has been marked as a duplicate of this bug. ***


[Bug target/49446] avr-g++ does not optimize when using bitshift in inlined function

2011-06-17 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

HotHead gcc at emailgo dot de changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE

--- Comment #1 from HotHead gcc at emailgo dot de 2011-06-17 21:38:20 UTC ---
duplicate of 33049

*** This bug has been marked as a duplicate of bug 33049 ***


[Bug target/49446] New: avr-g++ does not optimize when using bitshift in inlined function

2011-06-16 Thread gcc at emailgo dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49446

   Summary: avr-g++ does not optimize when using bitshift in
inlined function
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: g...@emailgo.de


Hi,

so you wanted an *.i* file, I don't think this will be helpful. Anyway I
appended it.

I have a structure like this:

function call - inline function - inline function.

If the first Inline function (Button::Poll that is) passes a const number as
parameter pin_number to the second function (Port::get_pin) that is, then the
Poll::get_pin function returns *port_address  (1pin_number). That masks the
appropiate pin in the port (bit in byte). However that will be static, but only
optimize to some right rotates and then a compare against zero. It would be
possible to just use the AVR's sbis (if bit is set) and provide the pin_number.
And in fact that is the case when I call get_pin with (1pin_number) as
parameter and don't do the shifting in the second-level inline function (but in
the first).

I hope you understand what I mean. This issue might also apply to other
Platforms where this could be optimized.

My command was :  ./avr-gcc-4.6.0 -S -mmcu=atmega8 -Os
/home/oliver/AVR/io/test.cc -save-temps -v

and it's output:

Using built-in specs.
COLLECT_GCC=./avr-gcc-4.6.0
COLLECT_LTO_WRAPPER=/usr/local/avr/libexec/gcc/avr/4.6.0/lto-wrapper
Target: avr
Configured with: ../configure --target=avr --prefix=/usr/local/avr
--disable-nls --enable-languages=c,c++ --disable-libssp : (reconfigured)
../configure --target=avr --prefix=/usr/local/avr --disable-nls
--enable-languages=c,c++ --disable-libssp
Thread model: single
gcc version 4.6.0 (GCC) 
COLLECT_GCC_OPTIONS='-S' '-mmcu=atmega8' '-Os' '-save-temps' '-v'
 /usr/local/avr/libexec/gcc/avr/4.6.0/cc1plus -E -quiet -v -imultilib avr4
/home/oliver/AVR/io/test.cc -mmcu=atmega8 -Os -fpch-preprocess -fno-rtti
-fno-enforce-eh-specs -fno-exceptions -o test.ii
ignoring nonexistent directory
/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/include/c++/4.6.0
ignoring nonexistent directory
/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/include/c++/4.6.0/avr/avr4
ignoring nonexistent directory
/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/include/c++/4.6.0/backward
ignoring nonexistent directory
/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/sys-include
#include ... search starts here:
#include ... search starts here:
 /usr/local/avr/lib/gcc/avr/4.6.0/include
 /usr/local/avr/lib/gcc/avr/4.6.0/include-fixed
 /usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/include
End of search list.
COLLECT_GCC_OPTIONS='-S' '-mmcu=atmega8' '-Os' '-save-temps' '-v'
 /usr/local/avr/libexec/gcc/avr/4.6.0/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.cc -mmcu=atmega8 -auxbase test -Os -version -o test.s -fno-rtti
-fno-enforce-eh-specs -fno-exceptions
GNU C++ (GCC) version 4.6.0 (avr)
compiled by GNU C version 4.6.1 20110526 (prerelease), GMP version 5.0.1,
MPFR version 3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.6.0 (avr)
compiled by GNU C version 4.6.1 20110526 (prerelease), GMP version 5.0.1,
MPFR version 3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: bed1f0f30349434b4d9bd9c4315cba61
COMPILER_PATH=/usr/local/avr/libexec/gcc/avr/4.6.0/:/usr/local/avr/libexec/gcc/avr/4.6.0/:/usr/local/avr/libexec/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.6.0/:/usr/local/avr/lib/gcc/avr/
LIBRARY_PATH=/usr/local/avr/lib/gcc/avr/4.6.0/avr4/:/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/lib/avr4/:/usr/local/avr/lib/gcc/avr/4.6.0/:/usr/local/avr/lib/gcc/avr/4.6.0/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-S' '-mmcu=atmega8' '-Os' '-save-temps' '-v'


Have fun!