<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 May 29, 2015, at 11:05 AM, Matt Arsenault <<a href="mailto:arsenm2@gmail.com" class="">arsenm2@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 29, 2015, at 10:51 AM, escha <<a href="mailto:escha@apple.com" class="">escha@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px; color: rgb(0, 132, 0);"><span class="" style=""><br class="Apple-interchange-newline"> </span>/// Returns a type large enough to hold any valid shift amount - before type</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px; color: rgb(0, 132, 0);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>/// legalization these can be huge.</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">EVT</span><span class="Apple-converted-space"> </span>getShiftAmountTy(<span class="" style="color: rgb(79, 129, 135);">EVT</span><span class="Apple-converted-space"> </span>LHSTy) {</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(120, 73, 42);">assert</span><span class="" style="">(LHSTy.</span><span class="" style="color: rgb(49, 89, 93);">isInteger</span><span class="" style="">() &&<span class="Apple-converted-space"> </span></span>"Shift amount is not an integer type!"<span class="" style="">);</span></div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">if</span><span class="Apple-converted-space"> </span>(LHSTy.<span class="" style="color: rgb(49, 89, 93);">isVector</span>())</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">return</span><span class="Apple-converted-space"> </span>LHSTy;</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px; color: rgb(49, 89, 93);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(187, 44, 162);">return</span><span class="" style=""> </span><span class="" style="color: rgb(79, 129, 135);">LegalTypes</span><span class="" style=""><span class="Apple-converted-space"> </span>?<span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">TLI</span><span class="" style="">.</span>getScalarShiftAmountTy<span class="" style="">(LHSTy)</span></div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px;"> :<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">TLI</span>.<span class="" style="color: rgb(49, 89, 93);">getPointerTy</span>();</div><div class="" style="font-family: Menlo; font-size: 11px; 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; margin: 0px;"> }</div><br class="Apple-interchange-newline"></div></blockquote></div><br class=""><div class="">I didn’t know about this one. Why does this exist? This seems insane. Does anything break if you replace everything with TLI.getShiftAmountTy()?</div></div></div></blockquote></div><br class=""><div class="">If I understand correctly, the reasoning is like this…</div><div class=""><br class=""></div><div class="">On x86:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">MVT</span> getScalarShiftAmountTy(<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">EVT</span> LHSTy) <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">override</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">MVT</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">i8</span>; }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">But prior to legalization you can have large types, e.g. i1024, whose shift amounts won’t fit in i8. So you need to allow larger shift types.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">—escha</div></body></html>