[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 11:12:33 PDT 2024


================
@@ -4707,6 +4707,12 @@ def HLSLIsinf : LangBuiltin<"HLSL_LANG"> {
   let Prototype = "void(...)";
 }
 
+def HLSLLength : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_elementwise_length"];
----------------
farzonl wrote:

I agree with Justin, This shouldn't be an elementwise builtin see `lerp`, `dot`, and `mad`. For operations that work on vectors and generate scalar results we don't add the `elementwise` naming convention. Reserve `elementwise` for cases were the function takes multiple inputs applys the same operation to each input then returns the same number of outputs.

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


More information about the cfe-commits mailing list