LLVM: include/llvm/TargetParser/RISCVTargetParser.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_TARGETPARSER_RISCVTARGETPARSER_H
15#define LLVM_TARGETPARSER_RISCVTARGETPARSER_H
16
21
22namespace llvm {
23
25
27
40
49
50
53
56 bool NeedPlus = false);
61 bool IsRV64);
63 bool IsRV64);
69
70}
71
83
84enum {
88};
89
90
94
95
96inline static bool isValidLMUL(unsigned LMUL, bool Fractional) {
97 return isPowerOf2_32(LMUL) && LMUL <= 8 && (!Fractional || LMUL != 1);
98}
99
101 bool MaskAgnostic, bool AltFmt = false);
102
104
106 unsigned VLMul = VType & 0x7;
107 return static_cast<VLMUL>(VLMul);
108}
109
110
112
115 unsigned LmulLog2 = Log2_32(LMUL);
116 return static_cast<VLMUL>(Fractional ? 8 - LmulLog2 : LmulLog2);
117}
118
119inline static unsigned decodeVSEW(unsigned VSEW) {
120 assert(VSEW < 8 && "Unexpected VSEW value");
121 return 1 << (VSEW + 3);
122}
123
128
129inline static unsigned getSEW(unsigned VType) {
130 unsigned VSEW = (VType >> 3) & 0x7;
132}
133
135 assert((TWiden == 1 || TWiden == 2 || TWiden == 3) &&
136 "Unexpected TWiden value");
137 return 1 << (TWiden - 1);
138}
139
141 unsigned TWiden = (VType >> 9) & 0x3;
142 return TWiden != 0;
143}
144
146 unsigned TWiden = (VType >> 9) & 0x3;
147 assert(TWiden != 0 && "Invalid widen value");
148 return 1 << (TWiden - 1);
149}
150
155
156inline static bool isTailAgnostic(unsigned VType) { return VType & 0x40; }
157
158inline static bool isMaskAgnostic(unsigned VType) { return VType & 0x80; }
159
160inline static bool isAltFmt(unsigned VType) { return VType & 0x100; }
161
163
165
167
169 unsigned EEW);
170}
171
172}
173
174#endif
static SDValue Widen(SelectionDAG *CurDAG, SDValue N)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition RISCVTargetParser.h:72
static bool isTailAgnostic(unsigned VType)
Definition RISCVTargetParser.h:156
static VLMUL encodeLMUL(unsigned LMUL, bool Fractional)
Definition RISCVTargetParser.h:113
static unsigned decodeVSEW(unsigned VSEW)
Definition RISCVTargetParser.h:119
@ TAIL_UNDISTURBED_MASK_UNDISTURBED
Definition RISCVTargetParser.h:85
@ TAIL_AGNOSTIC
Definition RISCVTargetParser.h:86
@ MASK_AGNOSTIC
Definition RISCVTargetParser.h:87
LLVM_ABI void printXSfmmVType(unsigned VType, raw_ostream &OS)
VLMUL
Definition RISCVTargetParser.h:73
@ LMUL_4
Definition RISCVTargetParser.h:76
@ LMUL_RESERVED
Definition RISCVTargetParser.h:78
@ LMUL_1
Definition RISCVTargetParser.h:74
@ LMUL_2
Definition RISCVTargetParser.h:75
@ LMUL_8
Definition RISCVTargetParser.h:77
@ LMUL_F4
Definition RISCVTargetParser.h:80
@ LMUL_F8
Definition RISCVTargetParser.h:79
@ LMUL_F2
Definition RISCVTargetParser.h:81
LLVM_ABI std::optional< VLMUL > getSameRatioLMUL(unsigned SEW, VLMUL VLMUL, unsigned EEW)
LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt)
static unsigned getXSfmmWiden(unsigned VType)
Definition RISCVTargetParser.h:145
static bool isValidLMUL(unsigned LMUL, bool Fractional)
Definition RISCVTargetParser.h:96
static bool isMaskAgnostic(unsigned VType)
Definition RISCVTargetParser.h:158
LLVM_ABI std::pair< unsigned, bool > decodeVLMUL(VLMUL VLMul)
static bool hasXSfmmWiden(unsigned VType)
Definition RISCVTargetParser.h:140
static unsigned encodeSEW(unsigned SEW)
Definition RISCVTargetParser.h:124
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul)
static bool isValidSEW(unsigned SEW)
Definition RISCVTargetParser.h:91
LLVM_ABI void printVType(unsigned VType, raw_ostream &OS)
static bool isValidXSfmmVType(unsigned VTypeI)
Definition RISCVTargetParser.h:151
static unsigned decodeTWiden(unsigned TWiden)
Definition RISCVTargetParser.h:134
static bool isAltFmt(unsigned VType)
Definition RISCVTargetParser.h:160
LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic, bool MaskAgnostic, bool AltFmt=false)
static unsigned getSEW(unsigned VType)
Definition RISCVTargetParser.h:129
static VLMUL getVLMUL(unsigned VType)
Definition RISCVTargetParser.h:105
Definition RISCVTargetParser.h:26
LLVM_ABI bool hasFastVectorUnalignedAccess(StringRef CPU)
LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< std::string > &EnabledFeatures, bool NeedPlus=false)
LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI CPUModel getCPUModel(StringRef CPU)
LLVM_ABI StringRef getMArchFromMcpu(StringRef CPU)
LLVM_ABI bool parseCPU(StringRef CPU, bool IsRV64)
LLVM_ABI bool hasFastScalarUnalignedAccess(StringRef CPU)
static constexpr unsigned RVVBitsPerBlock
Definition RISCVTargetParser.h:51
LLVM_ABI bool hasValidCPUModel(StringRef CPU)
LLVM_ABI StringRef getCPUNameFromCPUModel(const CPUModel &Model)
static constexpr unsigned RVVBytesPerBlock
Definition RISCVTargetParser.h:52
LLVM_ABI bool parseTuneCPU(StringRef CPU, bool IsRV64)
LLVM_ABI void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
This is an optimization pass for GlobalISel generic memory operations.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition RISCVTargetParser.h:41
StringLiteral Name
Definition RISCVTargetParser.h:42
StringLiteral DefaultMarch
Definition RISCVTargetParser.h:43
bool is64Bit() const
Definition RISCVTargetParser.h:47
bool FastVectorUnalignedAccess
Definition RISCVTargetParser.h:45
CPUModel Model
Definition RISCVTargetParser.h:46
bool FastScalarUnalignedAccess
Definition RISCVTargetParser.h:44
Definition RISCVTargetParser.h:28
uint32_t MVendorID
Definition RISCVTargetParser.h:29
uint64_t MArchID
Definition RISCVTargetParser.h:30
bool isValid() const
Definition RISCVTargetParser.h:33
bool operator==(const CPUModel &Other) const
Definition RISCVTargetParser.h:35
uint64_t MImpID
Definition RISCVTargetParser.h:31