[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2011-07-02 Thread gjl at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43088

--- Comment #6 from Georg-Johann Lay  2011-07-02 
21:07:50 UTC ---
Created attachment 24659
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24659
C source file

Compile with -mmcu=atmega168 -Os.

This file shows the flaw in function foo_3f that compares against 0x3f in
comparison to foo_3e that compares against 0x3e.

If the comparison is against 0x3e the code is fine.

The difference happens in pass combine. For 0x3f, combine tryes ZERO_EXTRACT:

Trying 8, 9 -> 10:
Failed to match this instruction:
(parallel [
(set (cc0)
(compare (zero_extract:HI (reg:QI 43 [ count.3 ])
(const_int 6 [0x6])
(const_int 0 [0]))
(const_int 0 [0])))
(clobber (scratch:QI))
])
Failed to match this instruction:
(set (cc0)
(compare (zero_extract:HI (reg:QI 43 [ count.3 ])
(const_int 6 [0x6])
(const_int 0 [0]))
(const_int 0 [0])))
Failed to match this instruction:
(set (reg:HI 52)
(zero_extract:HI (reg:QI 43 [ count.3 ])
(const_int 6 [0x6])
(const_int 0 [0])))

.


But for 0x3e it tryes AND, which matches (presumably combine-split):

Trying 8, 9 -> 10:
Failed to match this instruction:
(parallel [
(set (cc0)
(compare (and:QI (reg:QI 43 [ count.1 ])
(const_int 62 [0x3e]))
(const_int 0 [0])))
(clobber (scratch:QI))
])
Failed to match this instruction:
(set (cc0)
(compare (and:QI (reg:QI 43 [ count.1 ])
(const_int 62 [0x3e]))
(const_int 0 [0])))
Successfully matched this instruction:
(set (reg:QI 52)
(and:QI (reg:QI 43 [ count.1 ])
(const_int 62 [0x3e])))
Successfully matched this instruction:
(set (cc0)
(compare (reg:QI 52)
(const_int 0 [0])))
deferring deletion of insn with uid = 8.
...


[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2011-06-10 Thread gjl at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43088

Georg-Johann Lay  changed:

   What|Removed |Added

   Keywords||missed-optimization
 CC||gjl at gcc dot gnu.org
  Known to fail||

--- Comment #5 from Georg-Johann Lay  2011-06-10 
19:59:47 UTC ---
Funnc artifact. It occurs only if all low-bits are set, i.e. wich constants
0x3f, 0x1f, 0xf, ... So persumably a middle and pass makes some strange
assumption.

(In reply to comment #1)
> This bug is confirmed. andhi3/andsi3 causing this problem. conditional checks
> in andhi3 and andsi3 need to compare with zero instead of 0xff [etc]. 
> i.e. in andhi3 we need to replace
> (mask & 0x00ff) != 0xff by (mask & 0x00ff) != 0.
> 
> Similarly other checks in andhi3 and andsi3 need to be replaced.

Can you explain?

ANDding on a 8-bit part can only be omitted if the mask is 0xff. Otherwise, the
AND has to be performed, even if the result is known to be always zero.


[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2010-09-20 Thread eric dot weddington at atmel dot com


--- Comment #4 from eric dot weddington at atmel dot com  2010-09-20 12:58 
---
(In reply to comment #3)
> 
> It exits for the reported version (4.4.3) and as well as for trunk/4.6.
> 

Abnikant, could you also post the patch that fixes this problem? Thanks.


-- 

eric dot weddington at atmel dot com changed:

   What|Removed |Added

  Known to fail||4.4.3 4.6.0


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



[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2010-09-19 Thread abnikant dot singh at atmel dot com


--- Comment #3 from abnikant dot singh at atmel dot com  2010-09-20 04:24 
---
(In reply to comment #2)
> (In reply to comment #1)
> > This bug is confirmed. andhi3/andsi3 causing this problem. conditional 
> > checks
> > in andhi3 and andsi3 need to compare with zero instead of 0xff [etc]. 
> > i.e. in andhi3 we need to replace
> > (mask & 0x00ff) != 0xff by (mask & 0x00ff) != 0.
> > 
> > Similarly other checks in andhi3 and andsi3 need to be replaced.
> > 
> 
> Abnikant,
> 
> Is this bug confirmed for the reported version (4.4.3), or for trunk/4.6?
> 

It exits for the reported version (4.4.3) and as well as for trunk/4.6.


-- 


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



[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2010-09-19 Thread eric dot weddington at atmel dot com


--- Comment #2 from eric dot weddington at atmel dot com  2010-09-20 02:30 
---
(In reply to comment #1)
> This bug is confirmed. andhi3/andsi3 causing this problem. conditional checks
> in andhi3 and andsi3 need to compare with zero instead of 0xff [etc]. 
> i.e. in andhi3 we need to replace
> (mask & 0x00ff) != 0xff by (mask & 0x00ff) != 0.
> 
> Similarly other checks in andhi3 and andsi3 need to be replaced.
> 

Abnikant,

Is this bug confirmed for the reported version (4.4.3), or for trunk/4.6?


-- 

eric dot weddington at atmel dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-09-20 02:30:21
   date||


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



[Bug target/43088] [avr] Suspect optimizer missed code in gcc 4.4.3..

2010-09-12 Thread abnikant dot singh at atmel dot com


--- Comment #1 from abnikant dot singh at atmel dot com  2010-09-13 05:58 
---
This bug is confirmed. andhi3/andsi3 causing this problem. conditional checks
in andhi3 and andsi3 need to compare with zero instead of 0xff [etc]. 
i.e. in andhi3 we need to replace
(mask & 0x00ff) != 0xff by (mask & 0x00ff) != 0.

Similarly other checks in andhi3 and andsi3 need to be replaced.


-- 

abnikant dot singh at atmel dot com changed:

   What|Removed |Added

 CC||abnikant dot singh at atmel
   ||dot com


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