Skip to content

Commit 2147220

Browse files
committed
Address more review comments
1 parent f5bfd3f commit 2147220

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

llvm/test/tools/llvm-exegesis/RISCV/rvv/skip-rm.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
# VX-NOT: VXRM: {{(rne|rdn|rod)}}
99

1010
# FP: PseudoVFADD_VFPR16_M1_E16
11-
# FP: FRM: rne
12-
# FP-NOT: FRM: {{(rtz|rdn|rup|rmm|dyn)}}
11+
# FP: FRM: dyn
12+
# FP-NOT: FRM: {{(rtz|rdn|rup|rmm|rne)}}

llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ template <class BaseT> class RISCVSnippetGenerator : public BaseT {
159159
ELEN = STI.checkFeatures("+zve64x") ? 64 : 32;
160160

161161
std::string ZvlQuery;
162-
for (unsigned I = 5U, Size = (1 << I); I < 17U; ++I, Size <<= 1) {
162+
for (unsigned Size = 32; Size <= 65536; Size *= 2) {
163163
ZvlQuery = "+zvl";
164164
raw_string_ostream SS(ZvlQuery);
165165
SS << Size << "b";
@@ -460,15 +460,21 @@ void RISCVSnippetGenerator<BaseT>::annotateWithVType(
460460
if (HasRMOp) {
461461
VTypeOperands.insert(&Instr.Operands[RISCVII::getVLOpNum(MIDesc) - 1]);
462462

463-
// If we're not enumerating all rounding modes,
464-
// use zero (rne in FRM and rnu in VXRM) as the default
465-
// mode.
466-
RoundingModes = {0U};
467-
if (EnumerateRoundingModes) {
468-
RoundingModes.append({1, 2, 3});
469-
if (!UsesVXRM)
470-
// FRM values 5 and 6 are currently reserved.
471-
RoundingModes.append({4, 7});
463+
if (UsesVXRM) {
464+
// Use RNU as the default VXRM.
465+
RoundingModes = {RISCVVXRndMode::RNU};
466+
if (EnumerateRoundingModes)
467+
RoundingModes.append(
468+
{RISCVVXRndMode::RNE, RISCVVXRndMode::RDN, RISCVVXRndMode::ROD});
469+
} else {
470+
if (EnumerateRoundingModes)
471+
RoundingModes = {RISCVFPRndMode::RNE, RISCVFPRndMode::RTZ,
472+
RISCVFPRndMode::RDN, RISCVFPRndMode::RUP,
473+
RISCVFPRndMode::RMM};
474+
else
475+
// If we're not enumerating FRM, use DYN to instruct
476+
// RISCVInsertReadWriteCSRPass to insert nothing.
477+
RoundingModes = {RISCVFPRndMode::DYN};
472478
}
473479
} else {
474480
RoundingModes = {std::nullopt};
@@ -647,12 +653,12 @@ static std::vector<MCInst> loadFP64RegBits32(const MCSubtargetInfo &STI,
647653
return Instrs;
648654
}
649655

650-
// NOTE: Alternatively, we can use BitVector here, but the number of RVV MC
651-
// opcodes is just a small portion of the entire opcode space, so I thought it
652-
// would be a waste of space to use BitVector.
653-
static SmallSet<unsigned, 16> RVVMCOpcodesWithPseudos;
654-
655656
class ExegesisRISCVTarget : public ExegesisTarget {
657+
// NOTE: Alternatively, we can use BitVector here, but the number of RVV MC
658+
// opcodes is just a small portion of the entire opcode space, so I thought it
659+
// would be a waste of space to use BitVector.
660+
mutable SmallSet<unsigned, 16> RVVMCOpcodesWithPseudos;
661+
656662
public:
657663
ExegesisRISCVTarget();
658664

0 commit comments

Comments
 (0)