This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32044] [4.3 regression] udivdi3 counterproductive, unwarranted use
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2007 13:47:34 -0000
- Subject: [Bug middle-end/32044] [4.3 regression] udivdi3 counterproductive, unwarranted use
- References: <bug-32044-11706@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #18 from manu at gcc dot gnu dot org 2007-11-08 13:47 -------
(In reply to comment #4)
> > (probably the condition check is too conservative
> > so this isn't fully cooked yet):
>
> Way too conservative because even if you don't have the opcode, sometimes code
> can be produced without calling the libcall.
> If you change the define to:
> #define NSEC_PER_SEC 0x10000000UL
>
> You will not get an call udividi3, though there is still a divide in unsigned
> long long, the division can be done exactly (via shifting).
>
Just to understand the issue better. Which pass/function is responsible to
detect that the division can be done exactly and replace it by a shift? Can't
this be checked when the result is computed and moved outside the loop?
By the way, __builtin_expect generates a probability of >90% of exiting the
loop. Shouldn't that be taken into account when moving anything outside the
loop?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044