[clang] Adding `asuint` implementation to hlsl (PR #107292)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 10:58:11 PDT 2024
================
@@ -387,6 +387,23 @@ float3 asin(float3);
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
float4 asin(float4);
+//===----------------------------------------------------------------------===//
+// asuint builtins
+//===----------------------------------------------------------------------===//
+
+/// \fn uint asuint(T Val)
+/// \brief Interprets the bit pattern of x as an unsigned integer.
+/// \param Val The input value.
+
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_asuint)
+uint asuint(float);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_asuint)
+uint2 asuint(float2);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_asuint)
+uint3 asuint(float3);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_asuint)
+uint4 asuint(float4);
+
----------------
bogner wrote:
`IRBuilder::CreateBitCast` just returns the input if the type doesn't change, so the logic may already to the right thing.
https://github.com/llvm/llvm-project/pull/107292
More information about the cfe-commits
mailing list