================
@@ -4457,6 +4457,29 @@ class ConstantMatrixType final : public MatrixType {
return Column * NumRows + Row;
}
+ /// Given a row-major flattened index \p Index, return the corresponding
+ /// {row, column} position.
+ std::pair<unsigned, unsigned> getRowMajorRowAndColumn(unsigned Index) const {
+ return {Index / NumColumns, Index % NumColumns};
+ }
+
+ /// Given a column-major flattened index \p Index, return the corresponding
+ /// {row, column} position.
+ std::pair<unsigned, unsigned>
+ getColumnMajorRowAndColumn(unsigned Index) const {
+ return {Index % NumRows, Index / NumRows};
+ }
+
+ /// Given a flattened index \p Index, return the corresponding {row, column}
+ /// position. If \p IsRowMajor is true, interprets \p Index as a row-major
+ /// flattened index. Otherwise, interprets it as a column-major flattened
+ /// index.
+ std::pair<unsigned, unsigned> getRowAndColumn(unsigned Index,
+ bool IsRowMajor = false) const
{
+ return IsRowMajor ? getRowMajorRowAndColumn(Index)
+ : getColumnMajorRowAndColumn(Index);
+ }
+
----------------
farzonl wrote:
You are not using these anymore. Delete?
```suggestion
```
https://github.com/llvm/llvm-project/pull/184280
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits