[clang] Adding `asuint` implementation to hlsl (PR #107292)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 10 11:16:58 PDT 2024
================
@@ -387,6 +387,65 @@ 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.
+
+__attribute__((__always_inline__, __nodebug__)) static inline uint
----------------
farzonl wrote:
Justin is right, the static assert makes this no longer just an alias for `__builtin_bit_cast` so the macro name has to change at a minimum.
Also we mostly used macros to cover our attribute usage. So this is as much a new pattern as what you had. That said, while this isn't what I imagined this to look like I'm not opposed to how this turned out if the function body you defined is going to be reused across all our cast apis? That all depends on if the remaining cast work is boilerplate enough that this is flexible enough to support it.
https://github.com/llvm/llvm-project/pull/107292
More information about the cfe-commits
mailing list