Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 33049
Product:  
Component:  
Status: NEW
Resolution:
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Wouter van Gulik <wvangulik@xs4all.nl>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
test.c examples of good extraction and bad extraction text/plain 2007-08-11 17:56 798 bytes Edit
test.s Assembler output of testcase using 4.1.2 text/plain 2007-08-24 18:52 328 bytes Edit
test.s Correct assembler output of test case for 4.1.2. text/plain 2007-08-24 20:25 888 bytes Edit
test-gcc-4.2.1.s Test case assembler output for 4.2.1. text/plain 2007-08-24 20:30 877 bytes Edit
test-gcc-4.3.0-20070817.s Test case assembler output for 4.3.0 20070817 snapshot. text/plain 2007-08-24 20:35 711 bytes Edit
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 33049 depends on: Show dependency tree
Show dependency graph
Bug 33049 blocks:

Additional Comments:





Mark bug as waiting for feedback
Mark bug as suspended




View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2007-08-24 20:35 Opened: 2007-08-11 17:53
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.

------- Comment #1 From Wouter van Gulik 2007-08-11 17:56 -------
Created an attachment (id=14053) [edit]
examples of good extraction and bad extraction

Adding the test file showing the missed optimization

------- Comment #2 From Andrew Pinski 2007-08-11 17:58 -------
It might be interesting if you tried 4.2.1.

------- Comment #3 From Eric Weddington 2007-08-22 16:57 -------
Wouter, please attach the assembly output that you are getting for your test.c
file using 4.1.2. That way we can compare it to other compiler versions.

Thanks,
Eric

------- Comment #4 From Wouter van Gulik 2007-08-24 18:52 -------
Created an attachment (id=14105) [edit]
Assembler output of testcase using 4.1.2

This is the requested assembler output that Eric asked for

------- Comment #5 From Eric Weddington 2007-08-24 20:25 -------
Created an attachment (id=14106) [edit]
Correct assembler output of test case for 4.1.2.

------- Comment #6 From Eric Weddington 2007-08-24 20:30 -------
Created an attachment (id=14107) [edit]
Test case assembler output for 4.2.1.

Not really any better than 4.1.2.

------- Comment #7 From Eric Weddington 2007-08-24 20:35 -------
Created an attachment (id=14108) [edit]
Test case assembler output for 4.3.0 20070817 snapshot.

Again, only marginally better.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug