================
@@ -847,6 +848,14 @@ of different sizes and signs is forbidden in binary and 
ternary builtins.
                                                 semantics, see `LangRef
                                                 
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
                                                 for the comparison.
+ T __builtin_elementwise_clz(T x[, T y])        return the number of leading 0 
bits in the first argument. If          integer types
+                                                the first argument is 0 and an 
optional second argument is provided,
+                                                the second argument is 
returned. If the first argument is 0 but only
+                                                one argument is provided, the 
result is undefined.
----------------
efriedma-quic wrote:

Technically speaking, there's some LLVM IR operations which won't trigger UB on 
a poison value... but it's much narrower than an uninitialized variable.  In 
particular, poison propagates much more strongly, and it can end up poisoning 
adjacent fields in memory.  And it's not consistent with any form of 
"undefined" in any standard.  Because of that, I don't want to document any 
clang intrinsics as "returns poison".

"the result is undefined" is just that but worse: it's equally messy, and 
ambiguous.

So I think the only viable alternative to "the behavior is undefined" is "the 
result is unspecified"... which would mean we have to actually pick a value to 
return.

https://github.com/llvm/llvm-project/pull/131995
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to