[PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 16 01:13:59 PDT 2015


majnemer added a subscriber: majnemer.
majnemer added a comment.

In http://reviews.llvm.org/D12052#225194, @mkuper wrote:

> Thanks, Simon!
>  I've wanted to add the _undefined intrinsics for a while now, but never got to it.
>
> Anyway, this sort of implementation somewhat worries me. 
>  Yes, I know that the gcc intrinsics do something very similar. 
>  And I also know that in practice we'll get an undef value, nothing worse (assuming reading an uninitialized automatic variable is undefined behavior to begin with - which really depends on the spec interpretation :-) ). 
>  And I know this isn't likely to change anytime soon.
>
> Still, relying on what may be undefined behavior in the header files worries me, and I'd rather not have it implemented like that.
>  I was thinking about adding a __builtin_undef which explicitly resolves to an undef value. 
>  Does that make sense to you?


`__builtin_undef` seems like a pretty big hammer and does not sound trivial to implement.  Not all types that can be emitted have an `undef` representation.  For example, `x86_mmx` doesn't have an `undef` representation because there can be no constants of that type.  I'd recommend a more narrow implementation technique unless we really need a more general one.


Repository:
  rL LLVM

http://reviews.llvm.org/D12052





More information about the cfe-commits mailing list