================
@@ -148,6 +148,15 @@ template <typename T> constexpr T ldexp_impl(T X, T Exp) {
return exp2(Exp) * X;
}
+template <typename T, int Bitwidth> constexpr uint firstbithigh_impl(T X) {
+ return (Bitwidth - 1) - __builtin_hlsl_elementwise_firstbithigh(X);
+}
+
+template <typename T, int N, int Bitwidth>
+constexpr vector<uint, N> firstbithigh_impl(vector<T, N> X) {
+ return (Bitwidth - 1) - __builtin_hlsl_elementwise_firstbithigh(X);
----------------
farzonl wrote:
This does look like it would change the behavior of what DXC currently does
when targeting SPIRV.
https://godbolt.org/z/vq5EGKTq5
I think thats fine, because its a clear case of divergent behavior. Not sure
how we would document this for any vulkan shaders that break.
https://github.com/llvm/llvm-project/pull/166419
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits