public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14237] New: suboptimal comparison between long and long long
@ 2004-02-21 10:53 kazu at cs dot umass dot edu
2004-02-23 1:23 ` [Bug optimization/14237] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-21 10:53 UTC (permalink / raw)
To: gcc-bugs
unsigned long long g;
unsigned long
foo (unsigned long a)
{
return (a >= g) ? 1 : 0;
}
turns into
foo:
pushl %esi ; we wouldn't need this if %esi were untouched
movl g+4, %ecx
xorl %esi, %esi
pushl %ebx
cmpl %ecx, %esi ; we could use "testl" here because %esi == 0
movl 12(%esp), %ebx
movl $1, %eax
movl g, %edx
jb .L3
cmpl %edx, %ebx
jae .L2
.L3:
xorl %eax, %eax
.L2:
popl %ebx
popl %esi
ret
--
Summary: suboptimal comparison between long and long long
Product: gcc
Version: 3.5.0
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
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug optimization/14237] suboptimal comparison between long and long long
2004-02-21 10:53 [Bug optimization/14237] New: suboptimal comparison between long and long long kazu at cs dot umass dot edu
@ 2004-02-23 1:23 ` pinskia at gcc dot gnu dot org
2004-02-23 1:36 ` kazu at cs dot umass dot edu
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-23 1:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-23 01:23 -------
Confirmed, basically the problem is subregisters support sucks (most likely in combine).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC build triplet|i686-pc-linux-gnu |
GCC host triplet|i686-pc-linux-gnu |
GCC target triplet|i686-pc-linux-gnu |i386-pc-linux-gnu
Keywords| |pessimizes-code
Last reconfirmed|0000-00-00 00:00:00 |2004-02-23 01:23:46
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug optimization/14237] suboptimal comparison between long and long long
2004-02-21 10:53 [Bug optimization/14237] New: suboptimal comparison between long and long long kazu at cs dot umass dot edu
2004-02-23 1:23 ` [Bug optimization/14237] " pinskia at gcc dot gnu dot org
@ 2004-02-23 1:36 ` kazu at cs dot umass dot edu
2004-02-29 4:10 ` kazu at cs dot umass dot edu
2004-11-03 18:14 ` [Bug rtl-optimization/14237] " pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-23 1:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-02-23 01:36 -------
Yes, it would be nice if the combiner could do a little more like
simplifying an insn using information from other insns instead of
direct substitution.
Oh, forgot to mention: -O2 -fomit-frame-pointer. :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug optimization/14237] suboptimal comparison between long and long long
2004-02-21 10:53 [Bug optimization/14237] New: suboptimal comparison between long and long long kazu at cs dot umass dot edu
2004-02-23 1:23 ` [Bug optimization/14237] " pinskia at gcc dot gnu dot org
2004-02-23 1:36 ` kazu at cs dot umass dot edu
@ 2004-02-29 4:10 ` kazu at cs dot umass dot edu
2004-11-03 18:14 ` [Bug rtl-optimization/14237] " pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-29 4:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-02-29 04:10 -------
Basically, in the testcase code, we have the following sequence before
the first CSE.
(parallel [(set (reg:DI 61)
(zero_extend:DI (reg:SI 59)))
(clobber (reg:CC 17 flags))])
:
:
(set (reg:CC 17 flags)
(compare:CC (subreg:SI (reg:DI 61) 4)
(subreg:SI (reg:DI 64) 4)))
Note that (subreg:SI (reg:DI 61) 4) is 0 because of zero_extend.
Then I found this patch, which is for PR 13335.
http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01611.html
Unfortunately, the patch didn't solve the problem. I haven't analyzed
whether it has made this PR any easier to solve, but it at least shows
one way in which we can solve this PR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/14237] suboptimal comparison between long and long long
2004-02-21 10:53 [Bug optimization/14237] New: suboptimal comparison between long and long long kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-02-29 4:10 ` kazu at cs dot umass dot edu
@ 2004-11-03 18:14 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 18:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-03 18:14 -------
For PPC, we have:
cmplw cr7,r0,r9
cmpw cr6,r0,r9
bgtlr- cr7
beq- cr6,L6
equality test can be done logically or arthimaticly so we don't need both cmp*'s.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-05-30 03:50:25 |2004-11-03 18:14:14
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/14237] suboptimal comparison between long and long long
[not found] <bug-14237-5009@http.gcc.gnu.org/bugzilla/>
2006-01-15 20:26 ` pinskia at gcc dot gnu dot org
@ 2009-04-22 22:20 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 22:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2009-04-22 22:20 -------
We now get:
foo:
movl $1, %eax
movl g+4, %edx
testl %edx, %edx
jne .L3
movl 4(%esp), %edx
cmpl g, %edx
jb .L3
ret
.p2align 2,,3
.L3:
xorl %eax, %eax
ret
Fixed and has been fixed since 4.3.0.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/14237] suboptimal comparison between long and long long
[not found] <bug-14237-5009@http.gcc.gnu.org/bugzilla/>
@ 2006-01-15 20:26 ` pinskia at gcc dot gnu dot org
2009-04-22 22:20 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-15 20:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-01-15 20:26 -------
Hmm, we get:
foo:
movl 4(%esp), %edx
xorl %ecx, %ecx
movl $1, %eax
cmpl g+4, %ecx
jb .L3
cmpl g, %edx
jb .L3
ret
.p2align 2,,3
.L3:
xorl %eax, %eax
ret
-----
The only thing which is semi wrong now is:
xorl %ecx, %ecx
cmpl g+4, %ecx
Everything else looks good (well except on ppc where we still get the different
compares).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-22 22:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-21 10:53 [Bug optimization/14237] New: suboptimal comparison between long and long long kazu at cs dot umass dot edu
2004-02-23 1:23 ` [Bug optimization/14237] " pinskia at gcc dot gnu dot org
2004-02-23 1:36 ` kazu at cs dot umass dot edu
2004-02-29 4:10 ` kazu at cs dot umass dot edu
2004-11-03 18:14 ` [Bug rtl-optimization/14237] " pinskia at gcc dot gnu dot org
[not found] <bug-14237-5009@http.gcc.gnu.org/bugzilla/>
2006-01-15 20:26 ` pinskia at gcc dot gnu dot org
2009-04-22 22:20 ` 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).