[clang] [HLSL] Add matrix support for asuint16 (PR #234576)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 10:54:57 PDT 2026


================
@@ -140,6 +140,16 @@ void asuint(matrix<double, R, C>, out matrix<uint, R, C>,
 
 #ifdef __HLSL_ENABLE_16_BIT
 
+template <typename T, int R, int C>
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
+constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
+                                    __detail::is_same<uint16_t, T>::value ||
+                                    __detail::is_same<half, T>::value,
+                                matrix<int16_t, R, C>> asuint16(matrix<T, R, C>
----------------
joaosaffran wrote:

The return here should be `matrix<uint16_t, R, C>` instead, according to issue https://github.com/llvm/llvm-project/issues/184475.

The CodeGen tests hide this because their wrappers return `uint16_t4x4`, converting the result back to unsigned, so we should update those as well.

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


More information about the cfe-commits mailing list