[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 13:00:32 PDT 2025


================
@@ -35,6 +35,12 @@ length_vec_impl(vector<T, N> X) {
 #endif
 }
 
+template <typename T>
+constexpr vector<T, 4> dst_impl(vector<T, 4> Src0, vector<T, 4> Src1) {
+  vector<T, 4> Dest = {1, Src0[1] * Src1[1], Src0[2], Src1[3]};
+  return Dest;
----------------
metkarpoonam wrote:

Thank you for the suggestion. This change eliminates one store and one load instruction, and also removes the need for an additional variable, resulting in more efficient code.

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


More information about the cfe-commits mailing list