|
20 | 20 | #include "llvm/ADT/StringSwitch.h"
|
21 | 21 | #include "llvm/MC/MCInstrDesc.h"
|
22 | 22 | #include "llvm/Support/RISCVISAInfo.h"
|
| 23 | +#include "llvm/TargetParser/RISCVTargetParser.h" |
23 | 24 | #include "llvm/TargetParser/SubtargetFeature.h"
|
24 | 25 |
|
25 | 26 | namespace llvm {
|
@@ -124,23 +125,6 @@ enum {
|
124 | 125 | TargetOverlapConstraintTypeMask = 3ULL << TargetOverlapConstraintTypeShift,
|
125 | 126 | };
|
126 | 127 |
|
127 |
| -enum VLMUL : uint8_t { |
128 |
| - LMUL_1 = 0, |
129 |
| - LMUL_2, |
130 |
| - LMUL_4, |
131 |
| - LMUL_8, |
132 |
| - LMUL_RESERVED, |
133 |
| - LMUL_F8, |
134 |
| - LMUL_F4, |
135 |
| - LMUL_F2 |
136 |
| -}; |
137 |
| - |
138 |
| -enum { |
139 |
| - TAIL_UNDISTURBED_MASK_UNDISTURBED = 0, |
140 |
| - TAIL_AGNOSTIC = 1, |
141 |
| - MASK_AGNOSTIC = 2, |
142 |
| -}; |
143 |
| - |
144 | 128 | // Helper functions to read TSFlags.
|
145 | 129 | /// \returns the format of the instruction.
|
146 | 130 | static inline unsigned getFormat(uint64_t TSFlags) {
|
@@ -484,61 +468,6 @@ parseFeatureBits(bool IsRV64, const FeatureBitset &FeatureBits);
|
484 | 468 |
|
485 | 469 | } // namespace RISCVFeatures
|
486 | 470 |
|
487 |
| -namespace RISCVVType { |
488 |
| -// Is this a SEW value that can be encoded into the VTYPE format. |
489 |
| -inline static bool isValidSEW(unsigned SEW) { |
490 |
| - return isPowerOf2_32(SEW) && SEW >= 8 && SEW <= 1024; |
491 |
| -} |
492 |
| - |
493 |
| -// Is this a LMUL value that can be encoded into the VTYPE format. |
494 |
| -inline static bool isValidLMUL(unsigned LMUL, bool Fractional) { |
495 |
| - return isPowerOf2_32(LMUL) && LMUL <= 8 && (!Fractional || LMUL != 1); |
496 |
| -} |
497 |
| - |
498 |
| -unsigned encodeVTYPE(RISCVII::VLMUL VLMUL, unsigned SEW, bool TailAgnostic, |
499 |
| - bool MaskAgnostic); |
500 |
| - |
501 |
| -inline static RISCVII::VLMUL getVLMUL(unsigned VType) { |
502 |
| - unsigned VLMUL = VType & 0x7; |
503 |
| - return static_cast<RISCVII::VLMUL>(VLMUL); |
504 |
| -} |
505 |
| - |
506 |
| -// Decode VLMUL into 1,2,4,8 and fractional indicator. |
507 |
| -std::pair<unsigned, bool> decodeVLMUL(RISCVII::VLMUL VLMUL); |
508 |
| - |
509 |
| -inline static RISCVII::VLMUL encodeLMUL(unsigned LMUL, bool Fractional) { |
510 |
| - assert(isValidLMUL(LMUL, Fractional) && "Unsupported LMUL"); |
511 |
| - unsigned LmulLog2 = Log2_32(LMUL); |
512 |
| - return static_cast<RISCVII::VLMUL>(Fractional ? 8 - LmulLog2 : LmulLog2); |
513 |
| -} |
514 |
| - |
515 |
| -inline static unsigned decodeVSEW(unsigned VSEW) { |
516 |
| - assert(VSEW < 8 && "Unexpected VSEW value"); |
517 |
| - return 1 << (VSEW + 3); |
518 |
| -} |
519 |
| - |
520 |
| -inline static unsigned encodeSEW(unsigned SEW) { |
521 |
| - assert(isValidSEW(SEW) && "Unexpected SEW value"); |
522 |
| - return Log2_32(SEW) - 3; |
523 |
| -} |
524 |
| - |
525 |
| -inline static unsigned getSEW(unsigned VType) { |
526 |
| - unsigned VSEW = (VType >> 3) & 0x7; |
527 |
| - return decodeVSEW(VSEW); |
528 |
| -} |
529 |
| - |
530 |
| -inline static bool isTailAgnostic(unsigned VType) { return VType & 0x40; } |
531 |
| - |
532 |
| -inline static bool isMaskAgnostic(unsigned VType) { return VType & 0x80; } |
533 |
| - |
534 |
| -void printVType(unsigned VType, raw_ostream &OS); |
535 |
| - |
536 |
| -unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul); |
537 |
| - |
538 |
| -std::optional<RISCVII::VLMUL> |
539 |
| -getSameRatioLMUL(unsigned SEW, RISCVII::VLMUL VLMUL, unsigned EEW); |
540 |
| -} // namespace RISCVVType |
541 |
| - |
542 | 471 | namespace RISCVRVC {
|
543 | 472 | bool compress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI);
|
544 | 473 | bool uncompress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI);
|
|
0 commit comments