public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100890] New: The "div" standard library functions could be optimised as builtins
@ 2021-06-03 7:01 david at westcontrol dot com
2021-06-03 8:19 ` [Bug c/100890] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: david at westcontrol dot com @ 2021-06-03 7:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100890
Bug ID: 100890
Summary: The "div" standard library functions could be
optimised as builtins
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: david at westcontrol dot com
Target Milestone: ---
The C standard library has a family of functions for calculating the division
and remainder as a pair - "div", "ldiv", "lldiv", "imaxdiv". These could be
optimised by the compiler using inline code, in the same manner as many other
library functions such as the "abs" family (listed under "Other builtins" in
the manual).
For example, "div" can be implemented as:
div_t div(int a, int b) {
div_t d;
d.quot = a / b;
d.rem = a % b;
return d;
}
Inlining this in place of a call to "div" results in code that is smaller and
faster on most targets, as well as providing far more optimisation
opportunities (constant propagation, re-arranging with other code, etc.).
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/100890] The "div" standard library functions could be optimised as builtins
2021-06-03 7:01 [Bug c/100890] New: The "div" standard library functions could be optimised as builtins david at westcontrol dot com
@ 2021-06-03 8:19 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-03 8:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100890
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 70742.
*** This bug has been marked as a duplicate of bug 70742 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-03 8:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 7:01 [Bug c/100890] New: The "div" standard library functions could be optimised as builtins david at westcontrol dot com
2021-06-03 8:19 ` [Bug c/100890] " 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).