https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
jimis changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
--- Comment #5 from Ruslan ---
Yes, this is exactly the problem: the generic case is optimized while the
special case, where the divisor is a compile-time constant, isn't.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
--- Comment #4 from jimis ---
Indeed, as showcased by this example:
https://godbolt.org/g/nsSTHG
The function calls __udivmoddi4, like you said. However, the call is inlined in
main, but there we see separate calls for __udivdi3 and __umoddi3.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
--- Comment #3 from Ruslan ---
Ah, actually your problem is with a constant divisor. I reported it as bug
84759. If you change 10 to e.g. a function parameter, then you'll get
__udivmoddi4.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
--- Comment #2 from jimis ---
No, I still see the same behaviour with gcc 7.3 on my Fedora box.
Is the this link from godbolt showcasing it for you?
https://godbolt.org/g/dKEf39
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54183
Ruslan changed:
What|Removed |Added
CC||b7.10110111 at gmail dot com
--- Comment #1