<p><span class="h-card"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> </p><p>All compilers I&#39;ve seen can do this optimization. See for example <a href="https://godbolt.org/z/v34E58deK" target="_blank" rel="nofollow noopener noreferrer"><span class="invisible">https://</span><span class="">godbolt.org/z/v34E58deK</span><span class="invisible"></span></a>, which has the &quot;add a fixup from the upper word of the multiplication result&quot;. The reason why it&#39;s necessary is that you don&#39;t actually want multiplicative inverse modulo 2^wordsize in the case when the input value is not divisible by the constant.</p>
Reply