[llvm-commits] PATCH: Initial patches for changing the semantics of llvm.cttz and llvm.ctlz
chandlerc at gmail.com
Thu Dec 1 20:03:03 PST 2011
On Thu, Dec 1, 2011 at 11:20 AM, Dan Gohman <gohman at apple.com> wrote:
> On Dec 1, 2011, at 2:47 AM, Chandler Carruth wrote:
> > 7) remove all support (other than auto-upgrade) for the old intrinsics
> The "old" semantics really are more desirable though, in general. The only
> reason I know of for the "new" semantics is to cater to x86's old bsf and
> bsr instructions. But x86 admits its own deficiency, and has since
> the lzcnt and tzcnt instructions, which behave properly.
These instructions aren't widely available however, and as a consequence of
their rarity (and the GCC builtins), the overwhelming majority of the code
I've looked at using these has been tuned to preclude the possibility of
zero already (or to discard the result if in fact a zero is present).
So I don't really have a problem requiring a branch in the IR and letting
codegen match these away. Currently, this will be rare as most programs
have already dealt with this and don't really care.
Given an algorithm which does not need the zero-defined behavior, the
encoding for the old instructions is also smaller (based on my very limited
understanding of the Intel docs).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits