public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26270] New: missed vrp optimization with unsigned comparison
@ 2006-02-13 23:48 amodra at bigpond dot net dot au
2006-02-13 23:53 ` [Bug tree-optimization/26270] " amodra at bigpond dot net dot au
2006-02-13 23:59 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-02-13 23:48 UTC (permalink / raw)
To: gcc-bugs
f1 in the following could be optimized to generate the same code as f2.
(Taken from rs6000.c:rs6000_legitimate_offset_address_p.)
int
f1 (unsigned long offset, int x)
{
unsigned long extra = 0;
if (x)
extra = 4;
return offset < 0x100 && offset + extra < 0x100;
}
int
f2 (unsigned long offset, int x)
{
unsigned long extra = 0;
if (x)
extra = 4;
return offset < 0x100 - extra;
}
--
Summary: missed vrp optimization with unsigned comparison
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at bigpond dot net dot au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26270
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/26270] missed vrp optimization with unsigned comparison
2006-02-13 23:48 [Bug tree-optimization/26270] New: missed vrp optimization with unsigned comparison amodra at bigpond dot net dot au
@ 2006-02-13 23:53 ` amodra at bigpond dot net dot au
2006-02-13 23:59 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-02-13 23:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from amodra at bigpond dot net dot au 2006-02-13 23:53 -------
f1 in the following is optimized to f2
int
f1 (unsigned long offset)
{
return offset < 0x100 && offset + 4 < 0x100;
}
int
f2 (unsigned long offset)
{
return offset < 0xfc;
}
but f3 isn't seen as equivalent to f4
int
f3 (unsigned long offset)
{
unsigned long extra = 4;
return offset < 0x100 && offset + extra < 0x100;
}
int
f4 (unsigned long offset)
{
unsigned long extra = 4;
return offset < 0x100 - extra;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26270
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/26270] missed vrp optimization with unsigned comparison
2006-02-13 23:48 [Bug tree-optimization/26270] New: missed vrp optimization with unsigned comparison amodra at bigpond dot net dot au
2006-02-13 23:53 ` [Bug tree-optimization/26270] " amodra at bigpond dot net dot au
@ 2006-02-13 23:59 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 23:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-13 23:59 -------
(In reply to comment #1)
> f1 in the following is optimized to f2
> but f3 isn't seen as equivalent to f4
These are because fold is not recalled on the full expression a < CST0 && a +
CST1 < CST0.
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-02-13 23:59:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26270
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-13 23:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 23:48 [Bug tree-optimization/26270] New: missed vrp optimization with unsigned comparison amodra at bigpond dot net dot au
2006-02-13 23:53 ` [Bug tree-optimization/26270] " amodra at bigpond dot net dot au
2006-02-13 23:59 ` pinskia at gcc dot gnu dot 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).