public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor
@ 2004-12-17 14:16 pinskia at gcc dot gnu dot org
2004-12-17 14:23 ` [Bug rtl-optimization/19055] " segher at kernel dot crashing dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-17 14:16 UTC (permalink / raw)
To: gcc-bugs
The following two functions should produce the same assembly
int f(int a)
{
a|=1;
a^=1;
return a;
}
int f1(int a)
{
return a&~1;
}
--
Summary: Minor bit optimization with or and xor
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: rtl-optimization
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
GCC target triplet: powerpc-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
@ 2004-12-17 14:23 ` segher at kernel dot crashing dot org
2004-12-17 14:26 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: segher at kernel dot crashing dot org @ 2004-12-17 14:23 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |segher at kernel dot
| |crashing dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
2004-12-17 14:23 ` [Bug rtl-optimization/19055] " segher at kernel dot crashing dot org
@ 2004-12-17 14:26 ` pinskia at gcc dot gnu dot org
2004-12-19 14:02 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-17 14:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-17 14:25 -------
Another example where we don't get the optimization and f1 is still one instruction (on 32bit PPC):
int f(int a,int b)
{
a|=b;
a^=b;
return a;
}
int f1(int a,int b)
{
return a&=~b;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
2004-12-17 14:23 ` [Bug rtl-optimization/19055] " segher at kernel dot crashing dot org
2004-12-17 14:26 ` pinskia at gcc dot gnu dot org
@ 2004-12-19 14:02 ` pinskia at gcc dot gnu dot org
2004-12-22 7:42 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19 14:02 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-12-19 14:01:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-12-19 14:02 ` pinskia at gcc dot gnu dot org
@ 2004-12-22 7:42 ` pinskia at gcc dot gnu dot org
2005-02-22 19:02 ` [Bug tree-optimization/19055] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-22 7:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-22 07:42 -------
I had forgot to mention, I found this when Nathan was asking about a~=b (aka a&=~b) and Segher
sugessted a^=b;a|=b; and then we (Segher and I) both noticed that gcc was not doing the optimization.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-12-22 7:42 ` pinskia at gcc dot gnu dot org
@ 2005-02-22 19:02 ` pinskia at gcc dot gnu dot org
2005-07-05 0:02 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-22 19:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-22 14:44 -------
If we changed the function in comment #0 like so:
int f(int a)
{
a=(a|1)^1;
return a;
}
Fold should do this simplification.
And likewise for comment #1 (which is just general case):
int f(int a,int b)
{
a=(a|b) ^ b;
return a;
}
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |19987
nThis| |
Component|rtl-optimization |tree-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-02-22 19:02 ` [Bug tree-optimization/19055] " pinskia at gcc dot gnu dot org
@ 2005-07-05 0:02 ` pinskia at gcc dot gnu dot org
2005-07-05 13:53 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-05 0:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-05 00:02 -------
I have a fix which I will be testing over night.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-05-26 12:36:02 |2005-07-05 00:02:17
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-07-05 0:02 ` pinskia at gcc dot gnu dot org
@ 2005-07-05 13:53 ` pinskia at gcc dot gnu dot org
2005-07-21 19:34 ` cvs-commit at gcc dot gnu dot org
2005-07-21 19:34 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-05 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-05 13:53 -------
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00258.html>.
--
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2005-
| |07/msg00258.html
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-07-05 13:53 ` pinskia at gcc dot gnu dot org
@ 2005-07-21 19:34 ` cvs-commit at gcc dot gnu dot org
2005-07-21 19:34 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-21 19:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-07-21 19:34 -------
Subject: Bug 19055
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-07-21 19:33:50
Modified files:
gcc : ChangeLog fold-const.c
gcc/testsuite : ChangeLog
Log message:
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/19055
* gcc.dg/tree-ssa/pr19055.c: New test.
* gcc.dg/tree-ssa/pr19055-2.c: New test.
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/19055
* fold-const.c (fold_binary): Transform "(X | Y) ^ X" to "Y & ~ X".
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9501&r2=2.9502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.606&r2=1.607
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5798&r2=1.5799
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19055] Minor bit optimization with or and xor
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-07-21 19:34 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-21 19:34 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21 19:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-07-21 19:34 -------
Subject: Bug 19055
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-07-21 19:33:50
Modified files:
gcc : ChangeLog fold-const.c
gcc/testsuite : ChangeLog
Log message:
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/19055
* gcc.dg/tree-ssa/pr19055.c: New test.
* gcc.dg/tree-ssa/pr19055-2.c: New test.
2005-07-21 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/19055
* fold-const.c (fold_binary): Transform "(X | Y) ^ X" to "Y & ~ X".
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9501&r2=2.9502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.606&r2=1.607
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5798&r2=1.5799
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-21 19:34 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19055
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-07-21 19:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 14:16 [Bug rtl-optimization/19055] New: Minor bit optimization with or and xor pinskia at gcc dot gnu dot org
2004-12-17 14:23 ` [Bug rtl-optimization/19055] " segher at kernel dot crashing dot org
2004-12-17 14:26 ` pinskia at gcc dot gnu dot org
2004-12-19 14:02 ` pinskia at gcc dot gnu dot org
2004-12-22 7:42 ` pinskia at gcc dot gnu dot org
2005-02-22 19:02 ` [Bug tree-optimization/19055] " pinskia at gcc dot gnu dot org
2005-07-05 0:02 ` pinskia at gcc dot gnu dot org
2005-07-05 13:53 ` pinskia at gcc dot gnu dot org
2005-07-21 19:34 ` cvs-commit at gcc dot gnu dot org
2005-07-21 19:34 ` 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).