<div class="gmail_quote">BTW, I agree about grandfathering in existing ARM code that relies on this, but still potentially exposing safe and sane entry points for future code. Maybe the Intel intrinsics provide this interface? I don't recall.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">On Thu, Jan 26, 2012 at 3:02 PM, Bob Wilson <span dir="ltr"><<a href="mailto:bob.wilson@apple.com">bob.wilson@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How is it a divergence?  GCC says that the values are undefined.  This does not conflict with that.  It makes no difference on ARM codegen so the only real effect is to disable optimizations that try to take advantage of that undef.</blockquote>
</div><br><div>It is a divergence in that Clang is providing stricter guarantees than GCC. When folks complain "Hey, I developed my code w/ Clang, and everything worked great, but when my customer built it with GCC it miscompiled and exploded. WTF?" I want to have documentation of the Clang language extension that their code depends on.</div>
<div><br></div><div><br></div><div>As an unrelated (and orthogonal to your change) note, it would be good to make sure that LLVM folds code like:</div><div><br></div><div>int f(int x) { return x ? __builtin_clz(x) : sizeof(int)*8; }</div>
<div><br></div><div>on ARM to not have the dead condition. I tried to do this for a few cases, but I'm worried I might not have gotten it for all of them... Dunno when I'll get back to further hacking on this style of optimization.</div>