------- 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