[llvm] [RISCV][llvm-mca] Vector Unit Stride Loads and stores use EEW and EMU… (PR #69409)
Wang Pengcheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 23:50:10 PDT 2023
================
@@ -185,6 +187,59 @@ RISCVInstrumentManager::createInstruments(const MCInst &Inst) {
return SmallVector<UniqueInstrument>();
}
+/// Return EMUL = (EEW / SEW) * LMUL
+inline static std::pair<unsigned, bool>
+getEMULEqualsEEWDivSEWTimesLMUL(unsigned EEW, unsigned SEW,
+ RISCVII::VLMUL VLMUL) {
+ // Calculate (EEW/SEW)*LMUL preserving fractions less than 1. Use GCD
+ // to put fraction in simplest form.
+ auto [LMUL, Fractional] = RISCVVType::decodeVLMUL(VLMUL);
----------------
wangpc-pp wrote:
Can this function be simpler? For example, use `getSEWLMULRatio` (please verify the functionality):
```cpp
int Ratio = RISCVVType::getSEWLMULRatio(SEW, VLMUL);
int LMulFixedPoint = (EEW * 8) / Ratio;
bool Fractional = LMulFixedPoint < 8;
unsigned LMul = Fractional ? 8 / LMulFixedPoint : LMulFixedPoint / 8;
```
https://github.com/llvm/llvm-project/pull/69409
More information about the llvm-commits
mailing list