[clang] [llvm] [HLSL] implement elementwise firstbithigh hlsl builtin (PR #111082)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 10:22:32 PDT 2024


================
@@ -928,6 +928,78 @@ float3 exp2(float3);
 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
 float4 exp2(float4);
 
+//===----------------------------------------------------------------------===//
+// firstbithigh builtins
+//===----------------------------------------------------------------------===//
+
+/// \fn T firstbithigh(T Val)
+/// \brief Returns the location of the first set bit starting from the highest
+/// order bit and working downward, per component.
+/// \param Val the input value.
+
+#ifdef __HLSL_ENABLE_16_BIT
+_HLSL_AVAILABILITY(shadermodel, 6.2)
----------------
farzonl wrote:

I don't think the int16_t, uint16_t, int64_t, and uint64_t cases are correct.

https://github.com/llvm/llvm-project/pull/111082


More information about the cfe-commits mailing list