public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
@ 2004-05-01 12:58 kazu at cs dot umass dot edu
2004-05-01 12:58 ` [Bug optimization/15241] " kazu at cs dot umass dot edu
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-01 12:58 UTC (permalink / raw)
To: gcc-bugs
We should convert foo into bar (if profitable).
void baz ();
unsigned int
foo (unsigned int a, unsigned int b)
{
if (a <= 7 && b <= 7)
baz ();
}
unsigned int
bar (unsigned int a, unsigned int b)
{
if ((a | b) <= 7)
baz ();
}
The last SSA form looks like:
;; Function foo (foo)
foo (a, b)
{
_Bool T.2;
_Bool T.1;
_Bool T.0;
<bb 0>:
T.0_2 = a_1 <= 7;
T.1_4 = b_3 <= 7;
T.2_5 = T.0_2 && T.1_4;
if (T.2_5) goto <L0>; else goto <L1>;
<L0>:;
baz () [tail call];
<L1>:;
return;
}
;; Function bar (bar)
bar (a, b)
{
unsigned int T.3;
<bb 0>:
T.3_3 = a_1 | b_2;
if (T.3_3 <= 7) goto <L0>; else goto <L1>;
<L0>:;
baz () [tail call];
<L1>:;
return;
}
On i686-pc-linux-gnu, I get:
foo:
cmpl $7, 4(%esp)
setbe %dl
cmpl $7, 8(%esp)
setbe %al
testb %al, %dl
jne .L5
rep ; ret
.p2align 4,,7
.L5:
jmp baz
.size foo, .-foo
.p2align 4,,15
.globl bar
.type bar, @function
bar:
movl 8(%esp), %eax
orl 4(%esp), %eax
cmpl $7, %eax
jbe .L9
rep ; ret
.p2align 4,,7
.L9:
jmp baz
--
Summary: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
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=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
@ 2004-05-01 12:58 ` kazu at cs dot umass dot edu
2004-05-01 13:05 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-01 12:58 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
2004-05-01 12:58 ` [Bug optimization/15241] " kazu at cs dot umass dot edu
@ 2004-05-01 13:05 ` pinskia at gcc dot gnu dot org
2004-05-01 13:10 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-01 13:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-01 13:05 -------
Confirmed but note I think this should happen late in compiling.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-05-01 13:05:40
date| |
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
2004-05-01 12:58 ` [Bug optimization/15241] " kazu at cs dot umass dot edu
2004-05-01 13:05 ` pinskia at gcc dot gnu dot org
@ 2004-05-01 13:10 ` pinskia at gcc dot gnu dot org
2004-05-09 22:11 ` pinskia at gcc dot gnu dot org
2004-05-24 20:52 ` [Bug tree-optimization/15241] " pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-01 13:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-01 13:10 -------
On PPC the former is much worse than the later:
_foo:
subfic r3,r3,7
li r3,0
adde r3,r3,r3 // <-- r3 == r3 <=7 on some processors this is serializing
subfic r4,r4,7
li r4,0
adde r4,r4,r4 // <--r4 == r4 <=7 on some processors this is serializing
and. r0,r3,r4 // r0 = r4 & r3, cr0 = (rs3 & r4) == 0
beqlr- cr0 // return if cr0(equal) is true
b L_baz$stub
.align 2
.globl _bar
_bar:
or r4,r3,r4
cmplwi cr7,r4,7
bgtlr- cr7
b L_baz$stub
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-05-01 13:10 ` pinskia at gcc dot gnu dot org
@ 2004-05-09 22:11 ` pinskia at gcc dot gnu dot org
2004-05-24 20:52 ` [Bug tree-optimization/15241] " pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-09 22:11 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15357
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2004-05-09 22:11 ` pinskia at gcc dot gnu dot org
@ 2004-05-24 20:52 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 20:52 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15241
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-05-24 1:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-01 12:58 [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 kazu at cs dot umass dot edu
2004-05-01 12:58 ` [Bug optimization/15241] " kazu at cs dot umass dot edu
2004-05-01 13:05 ` pinskia at gcc dot gnu dot org
2004-05-01 13:10 ` pinskia at gcc dot gnu dot org
2004-05-09 22:11 ` pinskia at gcc dot gnu dot org
2004-05-24 20:52 ` [Bug tree-optimization/15241] " 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).