public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/30747] gcc should optimize x / (cond ? const1 : const2)
2007-02-09 15:41 [Bug rtl-optimization/30747] New: gcc should optimize x / (cond ? const1 : const2) ak at muc dot de
@ 2007-02-09 15:41 ` ak at muc dot de
2007-02-09 16:10 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: ak at muc dot de @ 2007-02-09 15:41 UTC (permalink / raw)
To: gcc-bugs
--
ak at muc dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Summary|gcc should optimize x / |gcc should optimize x /
|(cond ? const1 : const2) |(cond ? const1 : const2)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30747
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/30747] New: gcc should optimize x / (cond ? const1 : const2)
@ 2007-02-09 15:41 ak at muc dot de
2007-02-09 15:41 ` [Bug rtl-optimization/30747] " ak at muc dot de
2007-02-09 16:10 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: ak at muc dot de @ 2007-02-09 15:41 UTC (permalink / raw)
To: gcc-bugs
(seen on other targets too)
For
x / (cond ? const1 : const2)
gcc currently always generates a slow general purpose div. But it would
be much faster to rewrite it to
cond ? (x / const1 : x / const2)
and then use the optimized sequences for division by constant
In the Linux kernel there are a few cases where this would help.
e.g. it is common in device drivers which manage a ring buffer and the ring
size depends on the hardware revision.
It would be also useful for some other cases where it is not easy
to rewrite the code by hand to the better form.
I made it rtl-optimization, although I presume it could be as well
done on tree level?
--
Summary: gcc should optimize x / (cond ? const1 : const2)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ak at muc dot de
GCC target triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30747
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/30747] gcc should optimize x / (cond ? const1 : const2)
2007-02-09 15:41 [Bug rtl-optimization/30747] New: gcc should optimize x / (cond ? const1 : const2) ak at muc dot de
2007-02-09 15:41 ` [Bug rtl-optimization/30747] " ak at muc dot de
@ 2007-02-09 16:10 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-09 16:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-02-09 16:10 -------
Guess I am the master of all missed optimization bugs really :).
*** This bug has been marked as a duplicate of 22196 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30747
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-09 16:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 15:41 [Bug rtl-optimization/30747] New: gcc should optimize x / (cond ? const1 : const2) ak at muc dot de
2007-02-09 15:41 ` [Bug rtl-optimization/30747] " ak at muc dot de
2007-02-09 16:10 ` 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).