@@ -185,6 +185,38 @@ RISCVInstrumentManager::createInstruments(const MCInst &Inst) {
185
185
return SmallVector<UniqueInstrument>();
186
186
}
187
187
188
+ static std::pair<uint8_t , uint8_t >
189
+ getEEWAndEMULForUnitStrideLoadStore (unsigned Opcode, RISCVII::VLMUL LMUL,
190
+ uint8_t SEW) {
191
+ uint8_t EEW;
192
+ switch (Opcode) {
193
+ case RISCV::VLM_V:
194
+ case RISCV::VSM_V:
195
+ case RISCV::VLE8_V:
196
+ case RISCV::VSE8_V:
197
+ EEW = 8 ;
198
+ break ;
199
+ case RISCV::VLE16_V:
200
+ case RISCV::VSE16_V:
201
+ EEW = 16 ;
202
+ break ;
203
+ case RISCV::VLE32_V:
204
+ case RISCV::VSE32_V:
205
+ EEW = 32 ;
206
+ break ;
207
+ case RISCV::VLE64_V:
208
+ case RISCV::VSE64_V:
209
+ EEW = 64 ;
210
+ break ;
211
+ default :
212
+ llvm_unreachable (" Opcode is not a vector unit stride load nor store" );
213
+ }
214
+
215
+ uint8_t EMUL =
216
+ static_cast <uint8_t >(RISCVVType::getSameRatioLMUL (SEW, LMUL, EEW));
217
+ return std::make_pair (EEW, EMUL);
218
+ }
219
+
188
220
unsigned RISCVInstrumentManager::getSchedClassID (
189
221
const MCInstrInfo &MCII, const MCInst &MCI,
190
222
const llvm::SmallVector<Instrument *> &IVec) const {
@@ -214,12 +246,23 @@ unsigned RISCVInstrumentManager::getSchedClassID(
214
246
// or (Opcode, LMUL, SEW) if SEW instrument is active, and depends on LMUL
215
247
// and SEW, or (Opcode, LMUL, 0) if does not depend on SEW.
216
248
uint8_t SEW = SI ? SI->getSEW () : 0 ;
217
- // Check if it depends on LMUL and SEW
218
- const RISCVVInversePseudosTable::PseudoInfo *RVV =
219
- RISCVVInversePseudosTable::getBaseInfo (Opcode, LMUL, SEW);
220
- // Check if it depends only on LMUL
221
- if (!RVV)
222
- RVV = RISCVVInversePseudosTable::getBaseInfo (Opcode, LMUL, 0 );
249
+
250
+ const RISCVVInversePseudosTable::PseudoInfo *RVV = nullptr ;
251
+ if (Opcode == RISCV::VLM_V || Opcode == RISCV::VSM_V ||
252
+ Opcode == RISCV::VLE8_V || Opcode == RISCV::VSE8_V ||
253
+ Opcode == RISCV::VLE16_V || Opcode == RISCV::VSE16_V ||
254
+ Opcode == RISCV::VLE32_V || Opcode == RISCV::VSE32_V ||
255
+ Opcode == RISCV::VLE64_V || Opcode == RISCV::VSE64_V) {
256
+ RISCVII::VLMUL VLMUL = static_cast <RISCVII::VLMUL>(LMUL);
257
+ auto [EEW, EMUL] = getEEWAndEMULForUnitStrideLoadStore (Opcode, VLMUL, SEW);
258
+ RVV = RISCVVInversePseudosTable::getBaseInfo (Opcode, EMUL, EEW);
259
+ } else {
260
+ // Check if it depends on LMUL and SEW
261
+ RVV = RISCVVInversePseudosTable::getBaseInfo (Opcode, LMUL, SEW);
262
+ // Check if it depends only on LMUL
263
+ if (!RVV)
264
+ RVV = RISCVVInversePseudosTable::getBaseInfo (Opcode, LMUL, 0 );
265
+ }
223
266
224
267
// Not a RVV instr
225
268
if (!RVV) {
0 commit comments