[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 9 12:52:32 PST 2025


================
@@ -871,6 +871,34 @@ float3 degrees(float3);
 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees)
 float4 degrees(float4);
 
+//===----------------------------------------------------------------------===//
+// distance builtins
+//===----------------------------------------------------------------------===//
+
+/// \fn K distance(T X, T Y)
+/// \brief Returns a distance scalar between two vectors of \a X and \a Y.
+/// \param X The X input value.
+/// \param Y The Y input value.
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
----------------
farzonl wrote:

its only 6.2 for half data types. implementations.

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


More information about the cfe-commits mailing list