[cfe-commits] r149086 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtin-count-zeros.c

Chandler Carruth chandlerc at google.com
Thu Jan 26 16:47:53 PST 2012


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.

On Thu, Jan 26, 2012 at 3:02 PM, Bob Wilson <bob.wilson at apple.com> wrote:

> 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.


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.


As an unrelated (and orthogonal to your change) note, it would be good to
make sure that LLVM folds code like:

int f(int x) { return x ? __builtin_clz(x) : sizeof(int)*8; }

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120126/32bd1314/attachment.html>


More information about the cfe-commits mailing list