<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 20, 2015, at 10:22 AM, escha <<a href="mailto:escha@apple.com" class="">escha@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Aug 20, 2015, at 9:59 AM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">On Aug 20, 2015, at 9:46 AM, Steve King <<a href="mailto:steve@metrokings.com" class="">steve@metrokings.com</a>> wrote:<br class=""><br class="">On Wed, Aug 19, 2015 at 10:58 PM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">Isn’t the problem the fact that the patch makes it harder for a target to<br class="">get the generic code to reach its custom hook?<br class="">Now the "cheap pow2 sdiv” is merged with the generic “cheap div” you can’t<br class="">distinguish anymore.<br class=""><br class=""></blockquote><br class="">Yes and also the issue of needing more information to make a smart<br class="">isIntDivCheap() decision.<br class=""><br class="">In visitSDIV(), checking looks like this when the denominator is a power of 2.<br class=""><br class="">  if (TLI.isIntDivCheap(N->getValueType(0), MinSize))<br class="">    return SDValue();<br class=""><br class="">  // Target-specific implementation of sdiv x, pow2.<br class="">  if (SDValue Res = BuildSDIVPow2(N))<br class="">    return Res;<br class=""><br class="">How about this for isIntDivCheap?<br class="">1) pass Function* to allow the target to decide for itself which<br class="">attributes matter, and<br class=""></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">If you want the attributes, I think you should pass the attributes and not the whole Function.</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">I’m not sure why MinSize does not trigger with -Os by default, Michael is it intended?</span></div></blockquote><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I think -Oz might be MinSize?  -Oz being absolute minimum size at the cost of significant speed, IIRC.</div></div></blockquote><div><br class=""></div></div>Sure, the question is more what is the tradeoff for -Os.<div class="">My remember of -Os is somehow “don’t perform transformation that increases code size”. </div><div class="">It seems that it is what is done here: converting an (possibly expensive) division into multiple (less expensive) operations, probably increasing code size (target dependent admittedly).<br class=""><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""></div></div></body></html>