public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
@ 2004-04-04 16:47 kazu at cs dot umass dot edu
2004-04-04 16:55 ` [Bug optimization/14846] " kazu at cs dot umass dot edu
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-04 16:47 UTC (permalink / raw)
To: gcc-bugs
I wonder if the shift in (a >> 3) & 1 == 0 does any good for tree-ssa.
Consider:
void bar (void);
void
foo (unsigned int a)
{
if ((a & 8) != 0)
bar ();
}
I get:
T.0_2 = a_1 >> 3;
T.1_3 = (int)T.0_2;
T.2_4 = T.1_3 & 1;
T.3_5 = (_Bool)T.2_4;
if (T.3_5) goto <L0>; else goto <L1>;
Even if Andrew Pinski removes the _Bool and int cast,
T.0_2 = a_1 >> 3;
T.2_4 = T.0_2 & 1;
if (T.2_4 != 0) goto <L0>; else goto <L1>;
Without the shift,
T.2_4 = a_1 & 1;
if (T.2_4 != 0) goto <L0>; else goto <L1>;
Without the shift, it's a lot easier to combine two consecutive bit tests like
if (a & 1) goto there;
if (a & 4) goto there;
into
if (a & 5) goto there;
Removing the shift should also make it easier to solve PR 14752
because we don't have to look as many statements to do the optimization.
If we need the shift for some machine-specific reasons,
we should introduce it very late in tree-ssa optimizations or at expand time.
--
Summary: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0
until very late in tree-ssa optimizations
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
@ 2004-04-04 16:55 ` kazu at cs dot umass dot edu
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-04 16:55 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |roger at eyesopen dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
2004-04-04 16:55 ` [Bug optimization/14846] " kazu at cs dot umass dot edu
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
@ 2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
2004-04-04 16:56 ` kazu at cs dot umass dot edu
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04 16:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO|14847 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
@ 2004-04-04 16:56 ` kazu at cs dot umass dot edu
2004-05-15 23:23 ` [Bug tree-optimization/14846] " kazu at cs dot umass dot edu
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-04 16:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |14847
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
2004-04-04 16:55 ` [Bug optimization/14846] " kazu at cs dot umass dot edu
@ 2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04 16:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-04 16:56 -------
Confirmed, rewritting fold will help. Aka we should have an early fold and a late fold.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |memory-hog, pessimizes-code
Last reconfirmed|0000-00-00 00:00:00 |2004-04-04 16:56:51
date| |
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2004-04-04 16:56 ` kazu at cs dot umass dot edu
@ 2004-05-15 23:23 ` kazu at cs dot umass dot edu
2004-05-24 22:32 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-15 23:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-15 11:45 -------
As of today, the last tree-ssa form of foo() looks like:
foo (a)
{
_Bool T.3;
int T.2;
int T.1;
unsigned int T.0;
<bb 0>:
T.0_2 = a_1 >> 3;
T.1_3 = (int)T.0_2;
T.2_4 = T.1_3 & 1;
if (T.2_4 != 0) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
Note that the cast to _Bool is gone.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
` (4 preceding siblings ...)
2004-05-15 23:23 ` [Bug tree-optimization/14846] " kazu at cs dot umass dot edu
@ 2004-05-24 22:32 ` pinskia at gcc dot gnu dot org
2005-04-21 0:39 ` cvs-commit at gcc dot gnu dot org
2005-04-21 0:40 ` kazu at cs dot umass dot edu
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 22:32 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
` (5 preceding siblings ...)
2004-05-24 22:32 ` pinskia at gcc dot gnu dot org
@ 2005-04-21 0:39 ` cvs-commit at gcc dot gnu dot org
2005-04-21 0:40 ` kazu at cs dot umass dot edu
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-21 0:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-21 00:39 -------
Subject: Bug 14846
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: kazu@gcc.gnu.org 2005-04-21 00:39:25
Modified files:
gcc : ChangeLog fold-const.c
Log message:
PR tree-optimization/14846
* fold-const.c (fold_single_bit_test_into_sign_test): New,
split out from ...
(fold_single_bit_test): ... here.
(fold_binary): Call fold_single_bit_test_into_sign_test
instead of fold_single_bit_test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8381&r2=2.8382
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.566&r2=1.567
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/14846] [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
` (6 preceding siblings ...)
2005-04-21 0:39 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-21 0:40 ` kazu at cs dot umass dot edu
7 siblings, 0 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-21 0:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2005-04-21 00:40 -------
Just checked in a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-04-21 0:40 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-04 16:47 [Bug optimization/14846] New: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations kazu at cs dot umass dot edu
2004-04-04 16:55 ` [Bug optimization/14846] " kazu at cs dot umass dot edu
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
2004-04-04 16:56 ` pinskia at gcc dot gnu dot org
2004-04-04 16:56 ` kazu at cs dot umass dot edu
2004-05-15 23:23 ` [Bug tree-optimization/14846] " kazu at cs dot umass dot edu
2004-05-24 22:32 ` pinskia at gcc dot gnu dot org
2005-04-21 0:39 ` cvs-commit at gcc dot gnu dot org
2005-04-21 0:40 ` kazu at cs dot umass dot edu
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).