public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/101253] New: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0
@ 2021-06-29 8:53 antoshkka at gmail dot com
2021-12-23 0:39 ` [Bug tree-optimization/101253] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: antoshkka at gmail dot com @ 2021-06-29 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101253
Bug ID: 101253
Summary: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 ==
C0
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Consider the following code
bool test_naive(short i) {
return i % 100 == 0 || i % 400 == 0;
}
It could be optimized into
bool test_optim(short i) {
return i % 100 == 0;
}
Godbolt playground: https://godbolt.org/z/zW49qcs7G
P.S.: Inspired by the manual optimizations in libstdc++
https://github.com/gcc-mirror/gcc/commit/b92d12d3fe3f1aa56d190d960e40c62869a6cfbb
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/101253] Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0
2021-06-29 8:53 [Bug middle-end/101253] New: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0 antoshkka at gmail dot com
@ 2021-12-23 0:39 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23 0:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101253
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |tree-optimization
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-23 0:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 8:53 [Bug middle-end/101253] New: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0 antoshkka at gmail dot com
2021-12-23 0:39 ` [Bug tree-optimization/101253] " pinskia at gcc dot gnu.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).