<html><body><div><span style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;" data-mce-style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;">Hi all,</span><br class="" style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;" data-mce-style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;"><br class="" style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;" data-mce-style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;"><span style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;" data-mce-style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;">The following patch improves integer division sw expansion.</span><div class="" style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;" data-mce-style="font-family: SFNSText, 'Helvetica Neue', Helvetica, sans-serif;">Namely - the case of division by a constant, which would be<span class="" style="orphans: 2; widows: 2;" data-mce-style="orphans: 2; widows: 2;"> expanded to a simple multiplication by a magic number rather than a full division loop.</span><div class=""><div class="" style="margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: normal; orphans: 2; widows: 2;" data-mce-style="margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: normal; orphans: 2; widows: 2;">Implementation follows the DAG code in TargetLowering::BuildSDIV().<br class="" style="margin-top: 0px;" data-mce-style="margin-top: 0px;">Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's Guideā€.</div><div class="" style="margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: normal; orphans: 2; widows: 2;" data-mce-style="margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: normal; orphans: 2; widows: 2;"><br class=""></div>Please review.<br class="">Dmitri<div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D26819" class="" rel="noreferrer" data-mce-href="https://reviews.llvm.org/D26819">https://reviews.llvm.org/D26819</a></div></div></div></div></body></html>