[PATCH] D135086: [NFC][RISCV] Move getSEWLMULRatio function to header
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 5 07:12:17 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3e97e9423742: [NFC][RISCV] Move getSEWLMULRatio function to header (authored by asi-sc, committed by frasercrmck).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135086/new/
https://reviews.llvm.org/D135086
Files:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Index: llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -296,18 +296,6 @@
return Log2SEW == 0;
}
-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;
-}
-
/// Which subfields of VL or VTYPE have values we need to preserve?
struct DemandedFields {
bool VL = false;
@@ -347,10 +335,10 @@
return false;
if (Used.SEWLMULRatio) {
- auto Ratio1 = getSEWLMULRatio(RISCVVType::getSEW(VType1),
- RISCVVType::getVLMUL(VType1));
- auto Ratio2 = getSEWLMULRatio(RISCVVType::getSEW(VType2),
- RISCVVType::getVLMUL(VType2));
+ auto Ratio1 = RISCVVType::getSEWLMULRatio(RISCVVType::getSEW(VType1),
+ RISCVVType::getVLMUL(VType1));
+ auto Ratio2 = RISCVVType::getSEWLMULRatio(RISCVVType::getSEW(VType2),
+ RISCVVType::getVLMUL(VType2));
if (Ratio1 != Ratio2)
return false;
}
@@ -548,7 +536,7 @@
unsigned getSEWLMULRatio() const {
assert(isValid() && !isUnknown() &&
"Can't use VTYPE for uninitialized or unknown");
- return ::getSEWLMULRatio(SEW, VLMul);
+ return RISCVVType::getSEWLMULRatio(SEW, VLMul);
}
// Check if the VTYPE for these two VSETVLIInfos produce the same VLMAX.
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -455,6 +455,8 @@
void printVType(unsigned VType, raw_ostream &OS);
+unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul);
+
} // namespace RISCVVType
} // namespace llvm
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
@@ -185,4 +185,16 @@
OS << ", mu";
}
+unsigned RISCVVType::getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul) {
+ unsigned LMul;
+ bool Fractional;
+ std::tie(LMul, Fractional) = 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;
+}
+
} // namespace llvm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135086.465385.patch
Type: text/x-patch
Size: 2878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221005/8cab5b52/attachment.bin>
More information about the llvm-commits
mailing list