public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33049]  New: AVR: bit extraction non optimal, inversing logic solves problem
@ 2007-08-11 17:53 wvangulik at xs4all dot nl
  2007-08-11 17:56 ` [Bug c/33049] " wvangulik at xs4all dot nl
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: wvangulik at xs4all dot nl @ 2007-08-11 17:53 UTC (permalink / raw)
  To: gcc-bugs

Using this version/config:

~~~~~~~~~~~~~~~~~
Using built-in specs.
Target: avr
Configured with: ../gcc-4.1.2/configure --prefix=/c/WinAVR --target=avr
--enable
-languages=c,c++ --with-dwarf2 --enable-win32-registry=WinAVR-20070525
--disable
-nls --with-gmp=/usr/local --with-mpfr=/usr/local --enable-doc --disable-libssp
Thread model: single
gcc version 4.1.2 (WinAVR 20070525)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I compiled the source using this command line:

avr-gcc -S -Os test.c -mmcu=atmega16

These examples also suffers from double and instruction missed (bugID 11259)

The key point is that writing an expression like:
tmp = 0; if(var&(1<<N)) tmp|=1;
results in an N shift (done by loop if N larger then 3)

While rewriting to:
tmp = 0; if(var>>N)&1) tmp|=1;
This uses a swap instruction and then shifts. It's optimal (except from the
same loss as bugID 12259 for N >= 4)

Maybe this gives a hint on where the shifting is generally going wrong. I tried
3 approaches in the test.c file.

Another interresting thing is the removal off the extra and instructions in the
last examples in the file.


-- 
           Summary: AVR: bit extraction non optimal, inversing logic solves
                    problem
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wvangulik at xs4all dot nl


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33049


^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <bug-33049-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-09-18 12:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-11 17:53 [Bug c/33049] New: AVR: bit extraction non optimal, inversing logic solves problem wvangulik at xs4all dot nl
2007-08-11 17:56 ` [Bug c/33049] " wvangulik at xs4all dot nl
2007-08-11 17:58 ` [Bug target/33049] " pinskia at gcc dot gnu dot org
2007-08-22 16:58 ` [Bug target/33049] [avr] " eweddington at cso dot atmel dot com
2007-08-24 18:52 ` wvangulik at xs4all dot nl
2007-08-24 20:25 ` eweddington at cso dot atmel dot com
2007-08-24 20:30 ` eweddington at cso dot atmel dot com
2007-08-24 20:35 ` eweddington at cso dot atmel dot com
2007-08-24 20:36 ` eweddington at cso dot atmel dot com
2010-09-14  6:23 ` abnikant dot singh at atmel dot com
2010-09-14  6:25 ` abnikant dot singh at atmel dot com
     [not found] <bug-33049-4@http.gcc.gnu.org/bugzilla/>
2011-05-17 19:11 ` gjl at gcc dot gnu.org
2011-05-17 19:24 ` gjl at gcc dot gnu.org
2011-05-18  8:26 ` gjl at gcc dot gnu.org
2011-05-19 10:57 ` wvangulik at xs4all dot nl
2011-05-30 14:48 ` gjl at gcc dot gnu.org
2011-06-17 21:39 ` gcc at emailgo dot de
2011-06-20 10:52 ` gjl at gcc dot gnu.org
2011-06-20 10:59 ` gjl at gcc dot gnu.org
2011-06-20 11:02 ` gjl at gcc dot gnu.org
2011-06-21 17:32 ` gjl at gcc dot gnu.org
2011-06-21 17:38 ` gjl at gcc dot gnu.org
2011-09-18 12:35 ` gjl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).