[PATCH][X86] __builtin_ctz/clz sometimed defined for zero input

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu Oct 23 16:40:20 PDT 2014

In general, count-zeros instructions are undefined for a zero input value.
However the X86 TZCNT and LZCNT instructions do return the bit-width on a
zero input, so make Clang tell LLVM so.
One quirk is that these instructions aren't necessarily both defined, so
also create a separate predicate so we can do the right thing for all CPUs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctz-clz.diff
Type: application/octet-stream
Size: 3726 bytes
Desc: ctz-clz.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141023/45ed0d84/attachment.obj>

More information about the cfe-commits mailing list