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

Michael Kuperstein via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 16 00:40:59 PDT 2015


mkuper added a comment.

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?


================
Comment at: test/CodeGen/sse-undefined.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "xmm"
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep "ymm"
----------------
Perhaps a more explicit test?


Repository:
  rL LLVM

http://reviews.llvm.org/D12052





More information about the cfe-commits mailing list