public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/23673] New: fold does not fold (a^b) != 0 to a != b
@ 2005-09-01 2:31 pinskia at gcc dot gnu dot org
2005-09-17 2:12 ` [Bug middle-end/23673] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-01 2:31 UTC (permalink / raw)
To: gcc-bugs
These two functions should be the same on the tree level but are not:
int f(int a, int b)
{
return (a^b) != 0;
}
int f1(int a, int b)
{
return a != b;
}
They do result in the same asm though.
Another one from LLVM.
--
Summary: fold does not fold (a^b) != 0 to a != b
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: enhancement
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <bug-23673-6528@http.gcc.gnu.org/bugzilla/>]
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
@ 2005-11-30 16:44 ` pinskia at gcc dot gnu dot org
2005-12-02 3:17 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-30 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-30 16:44 -------
I am going to fix this one.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
2005-11-30 16:44 ` pinskia at gcc dot gnu dot org
@ 2005-12-02 3:17 ` pinskia at gcc dot gnu dot org
2005-12-02 18:12 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-02 3:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2005-12-02 03:17 -------
Hmm, this is getting harder (unless I just want to do (a^CST) == CST and (a^b)
== 0. I am still deciding if I want to fix fold_binary from stoping from
returning a new tree if it does nothing except for switch the order of the
operands).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
2005-11-30 16:44 ` pinskia at gcc dot gnu dot org
2005-12-02 3:17 ` pinskia at gcc dot gnu dot org
@ 2005-12-02 18:12 ` pinskia at gcc dot gnu dot org
2005-12-04 4:28 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-02 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2005-12-02 18:12 -------
ok, I have a fix without rewritting some of fold_binary. I just needed to
added a check for BIT_XOR_EXPR comming back, like invert_expr does.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2005-12-02 18:12 ` pinskia at gcc dot gnu dot org
@ 2005-12-04 4:28 ` pinskia at gcc dot gnu dot org
2006-02-25 23:36 ` sayle at gcc dot gnu dot org
2006-02-26 1:29 ` roger at eyesopen dot com
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-04 4:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2005-12-04 04:28 -------
I am no longer going to work on this, it is too much hasle to get this fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
URL|http://gcc.gnu.org/ml/gcc- |
|patches/2005- |
|12/msg00286.html |
Status|ASSIGNED |NEW
Keywords|patch |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2005-12-04 4:28 ` pinskia at gcc dot gnu dot org
@ 2006-02-25 23:36 ` sayle at gcc dot gnu dot org
2006-02-26 1:29 ` roger at eyesopen dot com
5 siblings, 0 replies; 8+ messages in thread
From: sayle at gcc dot gnu dot org @ 2006-02-25 23:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from sayle at gcc dot gnu dot org 2006-02-25 22:27 -------
Subject: Bug 23673
Author: sayle
Date: Sat Feb 25 22:27:54 2006
New Revision: 111442
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111442
Log:
PR middle-end/23673
* fold-const.c (fold_binary) <EQ_EXPR>: Fold (X^Y) == 0 as X == Y
and (X^Y) != 0 as X != Y. Fold (X^Y) == Y as X == 0, and some
symmetry related transformations. Fold (X^C1) == C2 as
X == (C1^C2).
* gcc.dg/fold-eqxor-1.c: New test case.
* gcc.dg/fold-eqxor-2.c: Likewise.
* gcc.dg/fold-eqxor-3.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.dg/fold-eqxor-1.c
trunk/gcc/testsuite/gcc.dg/fold-eqxor-2.c
trunk/gcc/testsuite/gcc.dg/fold-eqxor-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/23673] fold does not fold (a^b) != 0 to a != b
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2006-02-25 23:36 ` sayle at gcc dot gnu dot org
@ 2006-02-26 1:29 ` roger at eyesopen dot com
5 siblings, 0 replies; 8+ messages in thread
From: roger at eyesopen dot com @ 2006-02-26 1:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from roger at eyesopen dot com 2006-02-25 23:36 -------
Fixed on mainline.
--
roger at eyesopen dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23673
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-02-25 23:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-01 2:31 [Bug middle-end/23673] New: fold does not fold (a^b) != 0 to a != b pinskia at gcc dot gnu dot org
2005-09-17 2:12 ` [Bug middle-end/23673] " pinskia at gcc dot gnu dot org
[not found] <bug-23673-6528@http.gcc.gnu.org/bugzilla/>
2005-11-30 16:44 ` pinskia at gcc dot gnu dot org
2005-12-02 3:17 ` pinskia at gcc dot gnu dot org
2005-12-02 18:12 ` pinskia at gcc dot gnu dot org
2005-12-04 4:28 ` pinskia at gcc dot gnu dot org
2006-02-25 23:36 ` sayle at gcc dot gnu dot org
2006-02-26 1:29 ` roger at eyesopen dot com
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).