<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 13, 2019, at 10:45 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" class="">chandlerc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div dir="ltr" class="">On Fri, Sep 13, 2019 at 1:33 AM David Zarzycki via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class="">Hi Chandler,<div class=""><br class=""></div><div class="">The data-invariant feature sounds great but what about the general case? When performance tuning code, people sometimes need the ability to reliably generate CMOV, and right now the best advice is either “use inline assembly” or “keep refactoring until CMOV is emited” (and hope that future compilers continue to generate CMOV).</div><div class=""><br class=""></div><div class="">Given that a patch already exists to reliably generate CMOV, are there any good arguments against adding the feature?</div></div></blockquote><div class=""><br class=""></div><div class="">For *performance* tuning, the builtin that Hal mentioned is IMO the correct design.</div><div class=""><br class=""></div><div class="">Is there some reason why it doesn't work?</div></div></div></div></blockquote><br class=""></div><div>I wasn’t aware of __builtin_unpredictable() until now and I haven’t debugged why it doesn’t work, but here are a couple examples, one using the ternary operator and one using a switch statement:</div><div><br class=""></div><div><a href="https://godbolt.org/z/S46I_q" class="">https://godbolt.org/z/S46I_q</a></div><div><br class=""></div><div>Dave</div></body></html>