@pkhuong GCC even has an IR for this specific thing, called exact divide. It is used for pointer subtraction.
Conversation
Notices
-
Embed this notice
pinskia (pinskia@hachyderm.io)'s status on Tuesday, 17-Dec-2024 07:09:47 JST pinskia -
Embed this notice
Paul Khuong (pkhuong@discuss.systems)'s status on Tuesday, 17-Dec-2024 07:09:50 JST Paul Khuong Let's say you know the input is an exact multiple of your integer divisor. Does that let you come up with a smaller div-by-mul constant?
EDIT: I don't mean a reciprocal inverse mod 2^w, but literally a fixed point div by mul (which also avoids the need to ensure the divisor is odd).
-
Embed this notice