================
@@ -1135,6 +1136,23 @@ static Value *expandMatrixMultiply(CallInst *Orig) {
   return Result;
 }
 
+// Expand llvm.matrix.transpose as a shufflevector that permutes elements
+// from column-major source to column-major transposed layout.
+// Element (r,c) at index c*Rows + r moves to index r*Cols + c.
+static Value *expandMatrixTranspose(CallInst *Orig) {
+  Value *Mat = Orig->getArgOperand(0);
+  unsigned Rows = cast<ConstantInt>(Orig->getArgOperand(1))->getZExtValue();
+  unsigned Cols = cast<ConstantInt>(Orig->getArgOperand(2))->getZExtValue();
+
+  unsigned NumElts = Rows * Cols;
+  SmallVector<int, 16> Mask(NumElts);
+  for (unsigned I = 0; I < NumElts; ++I)
+    Mask[I] = (I % Cols) * Rows + (I / Cols);
----------------
farzonl wrote:

This should change once we complete this ticket correct? 
https://github.com/llvm/llvm-project/issues/184906

Wondering if we should link the issue as a TODO?

https://github.com/llvm/llvm-project/pull/186263
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to