@@ -149,17 +149,15 @@ template <class BaseT> class RISCVSnippetGenerator : public BaseT {
149149 RISCV::GPRRegClassID, RISCV::FPR16RegClassID, RISCV::VRRegClassID};
150150
151151 for (unsigned RegClassID : StandaloneRegClasses)
152- for (unsigned Reg : RegInfo.getRegClass (RegClassID)) {
152+ for (unsigned Reg : RegInfo.getRegClass (RegClassID))
153153 AggregateRegisters.reset (Reg);
154- }
155154
156155 // Initialize ELEN and VLEN.
157- // FIXME: We could have obtained these two from RISCVSubtarget
156+ // FIXME: We could have obtained these two constants from RISCVSubtarget
158157 // but in order to get that from TargetMachine, we need a Function.
159- const Triple &TT = State.getTargetMachine ().getTargetTriple ();
160- ELEN = TT.isRISCV32 () ? 32 : 64 ;
161-
162158 const MCSubtargetInfo &STI = State.getSubtargetInfo ();
159+ ELEN = STI.checkFeatures (" +zve64x" ) ? 64 : 32 ;
160+
163161 std::string ZvlQuery;
164162 for (unsigned I = 5U , Size = (1 << I); I < 17U ; ++I, Size <<= 1 ) {
165163 ZvlQuery = " +zvl" ;
@@ -175,15 +173,15 @@ template <class BaseT> class RISCVSnippetGenerator : public BaseT {
175173 const BitVector &ForbiddenRegisters) const override ;
176174};
177175
178- static bool isMaskedSibiling (unsigned MaskedOp, unsigned UnmaskedOp) {
176+ static bool isMaskedSibling (unsigned MaskedOp, unsigned UnmaskedOp) {
179177 const auto *RVVMasked = RISCV::getMaskedPseudoInfo (MaskedOp);
180178 return RVVMasked && RVVMasked->UnmaskedPseudo == UnmaskedOp;
181179}
182180
183181// There are primarily two kinds of opcodes that are not eligible
184182// in a serial snippet:
185- // (1) Only has a single use operand that can not be overlap with
186- // the def operand .
183+ // (1) Has a use operand that can not overlap with the def operand
184+ // (i.e. early clobber) .
187185// (2) The register file of the only use operand is different from
188186// that of the def operand. For instance, use operand is vector and
189187// the result is a scalar.
@@ -197,23 +195,15 @@ static bool isIneligibleOfSerialSnippets(unsigned BaseOpcode,
197195 case RISCV::VCOMPRESS_VM:
198196 case RISCV::VCPOP_M:
199197 case RISCV::VCPOP_V:
198+ // The permutation instructions listed below cannot have destination
199+ // overlapping with the source.
200200 case RISCV::VRGATHEREI16_VV:
201201 case RISCV::VRGATHER_VI:
202202 case RISCV::VRGATHER_VV:
203203 case RISCV::VRGATHER_VX:
204204 case RISCV::VSLIDE1UP_VX:
205205 case RISCV::VSLIDEUP_VI:
206206 case RISCV::VSLIDEUP_VX:
207- // The truncate instructions that arraive here are those who cannot
208- // have any overlap between source and dest at all (i.e.
209- // those whoe don't satisfy condition 2 and 3 in RVV spec
210- // 5.2).
211- case RISCV::VNCLIPU_WI:
212- case RISCV::VNCLIPU_WV:
213- case RISCV::VNCLIPU_WX:
214- case RISCV::VNCLIP_WI:
215- case RISCV::VNCLIP_WV:
216- case RISCV::VNCLIP_WX:
217207 return true ;
218208 default :
219209 return false ;
@@ -372,8 +362,8 @@ void RISCVSnippetGenerator<BaseT>::annotateWithVType(
372362 const auto *RVVBase =
373363 RISCVVInversePseudosTable::getBaseInfo (BaseOpcode, VLMul, SEW);
374364 if (RVVBase && (RVVBase->Pseudo == VPseudoOpcode ||
375- isMaskedSibiling (VPseudoOpcode, RVVBase->Pseudo ) ||
376- isMaskedSibiling (RVVBase->Pseudo , VPseudoOpcode))) {
365+ isMaskedSibling (VPseudoOpcode, RVVBase->Pseudo ) ||
366+ isMaskedSibling (RVVBase->Pseudo , VPseudoOpcode))) {
377367 // There is an integrated SEW, remove all but the SEW pushed last.
378368 SEWCandidates.erase (SEWCandidates.begin (), SEWCandidates.end () - 1 );
379369 break ;
@@ -395,7 +385,7 @@ void RISCVSnippetGenerator<BaseT>::annotateWithVType(
395385 }
396386 }
397387
398- // The EEW for source operand in VSEXT and VZEXT is a fractional
388+ // The EEW for source operand in VSEXT and VZEXT is a fraction
399389 // of the SEW, hence only SEWs that will lead to valid EEW are allowed.
400390 if (auto Frac = isRVVSignZeroExtend (BaseOpcode))
401391 if (*SEW / *Frac < MinSEW) {
@@ -411,7 +401,7 @@ void RISCVSnippetGenerator<BaseT>::annotateWithVType(
411401 Feature_HasStdExtZvksedBit,
412402 Feature_HasStdExtZvkshBit})) {
413403 if (*SEW != 32 )
414- // Zvknhb support SEW=64 as well.
404+ // Zvknhb supports SEW=64 as well.
415405 if (*SEW != 64 || !STI.hasFeature (RISCV::FeatureStdExtZvknhb) ||
416406 !isOpcodeAvailableIn (BaseOpcode,
417407 {Feature_HasStdExtZvknhaOrZvknhbBit})) {
0 commit comments