[llvm] 37fa585 - [RISCV] Move getSEWLMULRatio out of VSETVLIInfo [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 08:40:29 PDT 2022
Author: Philip Reames
Date: 2022-06-16T08:40:20-07:00
New Revision: 37fa5850f1c0b59537aa6cd7c45866ee640f928d
URL: https://github.com/llvm/llvm-project/commit/37fa5850f1c0b59537aa6cd7c45866ee640f928d
DIFF: https://github.com/llvm/llvm-project/commit/37fa5850f1c0b59537aa6cd7c45866ee640f928d.diff
LOG: [RISCV] Move getSEWLMULRatio out of VSETVLIInfo [nfc]
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index eaa8e74ebd3b..f757633c9a53 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -82,6 +82,17 @@ static bool isScalarMoveInstr(const MachineInstr &MI) {
}
}
+static unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul) {
+ unsigned LMul;
+ bool Fractional;
+ std::tie(LMul, Fractional) = RISCVVType::decodeVLMUL(VLMul);
+
+ // Convert LMul to a fixed point value with 3 fractional bits.
+ LMul = Fractional ? (8 / LMul) : (LMul * 8);
+
+ assert(SEW >= 8 && "Unexpected SEW value");
+ return (SEW * 8) / LMul;
+}
class VSETVLIInfo {
union {
@@ -216,22 +227,10 @@ class VSETVLIInfo {
Other.MaskAgnostic);
}
- static unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul) {
- unsigned LMul;
- bool Fractional;
- std::tie(LMul, Fractional) = RISCVVType::decodeVLMUL(VLMul);
-
- // Convert LMul to a fixed point value with 3 fractional bits.
- LMul = Fractional ? (8 / LMul) : (LMul * 8);
-
- assert(SEW >= 8 && "Unexpected SEW value");
- return (SEW * 8) / LMul;
- }
-
unsigned getSEWLMULRatio() const {
assert(isValid() && !isUnknown() &&
"Can't use VTYPE for uninitialized or unknown");
- return getSEWLMULRatio(SEW, VLMul);
+ return ::getSEWLMULRatio(SEW, VLMul);
}
// Check if the VTYPE for these two VSETVLIInfos produce the same VLMAX.
@@ -337,7 +336,7 @@ class VSETVLIInfo {
if (!hasSameAVL(Require))
return false;
- return getSEWLMULRatio() == getSEWLMULRatio(EEW, Require.VLMul);
+ return getSEWLMULRatio() == ::getSEWLMULRatio(EEW, Require.VLMul);
}
bool operator==(const VSETVLIInfo &Other) const {
@@ -1447,12 +1446,10 @@ static bool canMutatePriorConfig(const MachineInstr &PrevMI,
return false;
if (Used.SEWLMULRatio) {
- auto PriorRatio =
- VSETVLIInfo::getSEWLMULRatio(RISCVVType::getSEW(PriorVType),
- RISCVVType::getVLMUL(PriorVType));
- auto Ratio =
- VSETVLIInfo::getSEWLMULRatio(RISCVVType::getSEW(VType),
- RISCVVType::getVLMUL(VType));
+ auto PriorRatio = getSEWLMULRatio(RISCVVType::getSEW(PriorVType),
+ RISCVVType::getVLMUL(PriorVType));
+ auto Ratio = getSEWLMULRatio(RISCVVType::getSEW(VType),
+ RISCVVType::getVLMUL(VType));
if (PriorRatio != Ratio)
return false;
}
More information about the llvm-commits
mailing list