================
@@ -4265,6 +4271,91 @@ enum class VectorKind {
RVVFixedLengthMask_4
};
+/// True if \p VK is one of the RVV fixed-length data vector kinds, i.e. a
+/// riscv_rvv_vector_bits typedef of a data (non-mask) RVV type.
+inline bool isRVVFixedLengthDataVectorKind(VectorKind VK) {
+ switch (VK) {
+ case VectorKind::RVVFixedLengthData_MF8:
+ case VectorKind::RVVFixedLengthData_MF4:
+ case VectorKind::RVVFixedLengthData_MF2:
+ case VectorKind::RVVFixedLengthData_M1:
+ case VectorKind::RVVFixedLengthData_M2:
+ case VectorKind::RVVFixedLengthData_M4:
+ case VectorKind::RVVFixedLengthData_M8:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/// Return log2 of the LMUL recorded in an RVV fixed-length data vector kind:
+/// MF8 -> -3, MF4 -> -2, MF2 -> -1, M1 -> 0, M2 -> 1, M4 -> 2, M8 -> 3.
+inline int getRVVFixedLengthDataLMulLog2(VectorKind VK) {
+ switch (VK) {
+ case VectorKind::RVVFixedLengthData_MF8:
+ return -3;
+ case VectorKind::RVVFixedLengthData_MF4:
+ return -2;
+ case VectorKind::RVVFixedLengthData_MF2:
+ return -1;
+ case VectorKind::RVVFixedLengthData_M1:
+ return 0;
+ case VectorKind::RVVFixedLengthData_M2:
+ return 1;
+ case VectorKind::RVVFixedLengthData_M4:
+ return 2;
+ case VectorKind::RVVFixedLengthData_M8:
+ return 3;
+ default:
+ llvm_unreachable("not an RVV fixed-length data vector kind");
+ }
+}
+
+/// Return the LMUL of an RVV fixed-length data vector kind as a string:
+/// "mf8" .. "m8" if \p MF is true, "1/8" .. "8" otherwise.
+inline StringRef getRVVFixedLengthDataLMulString(VectorKind VK, bool MF) {
----------------
topperc wrote:
What does "MF" stand for?
https://github.com/llvm/llvm-project/pull/237845
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits