On Mon, Oct 27, 2014 at 7:17 PM, Chandler Carruth <[email protected]> wrote:
> > On Mon, Oct 27, 2014 at 7:07 PM, Sean Silva <[email protected]> wrote: > >> Curiously, it looks like GCC is depending on definedness for 0 in its own >> headers: >> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/lzcntintrin.h >> >> *shrug* >> > > I don't think that's really a justification for much of anything though. > > We should still add UBSan checks for this, and make our code correct > according to the spec for these builtins. > > Currently, I continue to prefer not using a builtin and instead defining > the __lzcnt stuff with a ternary operator. > That is my preference as well. If going forward we don't want to allow the 0 case to ever be defined, we should change the comment above isCLZForZeroUndef which currently says "on targets that support these operations in a way that provides well-defined results for zero without loss of performance, it is a good idea to avoid optimizing based on that undef behavior"; we should not claim it to be a "good idea" if usage of that hook is deprecated. -- Sean Silva
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
