[clang] Enable matrices in HLSL (PR #111415)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 15:46:32 PDT 2024


================
@@ -852,34 +852,50 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) {
 
 void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T,
                                             raw_ostream &OS) {
+  if (Policy.UseHLSLTypes)
+    OS << "matrix<";
   printBefore(T->getElementType(), OS);
-  OS << " __attribute__((matrix_type(";
-  OS << T->getNumRows() << ", " << T->getNumColumns();
-  OS << ")))";
----------------
llvm-beanz wrote:

This change seems wrong to me. IIUC this changes something like `float  __attribute__((matrix_type(4, 4)))*` to `float * __attribute__((matrix_type(4, 4)))`, which would mean the element type is `float*` rather than `float`.

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


More information about the cfe-commits mailing list