Skip to content

Commit 571e9a5

Browse files
Addressing review comments
1 parent aac3c98 commit 571e9a5

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ namespace exegesis {
2121
inline uint64_t getRISCVCpuCyclesCount() {
2222
#if defined(__riscv) && defined(__linux__)
2323
#if __riscv_xlen == 32
24-
uint32_t cycles_lo, cycles_hi0, cycles_hi1;
25-
asm volatile("rdcycleh %0\n"
26-
"rdcycle %1\n"
24+
uint32_t cycles_x3, cycles_x2, cycles_x4;
25+
asm volatile("again:\n"
26+
"rdcycleh %1\n"
27+
"rdcycle %0\n"
2728
"rdcycleh %2\n"
28-
"sub %0, %0, %2\n"
29-
"seqz %0, %0\n"
30-
"sub %0, zero, %0\n"
31-
"and %1, %1, %0\n"
32-
: "=r"(cycles_hi0), "=r"(cycles_lo), "=r"(cycles_hi1));
33-
return static_cast<uint64_t>((static_cast<uint64_t>(cycles_hi1) << 32) |
34-
cycles_lo);
29+
"bne %1, %2, again\n"
30+
: "=r"(cycles_x2), "=r"(cycles_x3), "=r"(cycles_x4));
31+
return static_cast<uint64_t>((static_cast<uint64_t>(cycles_x3) << 32) |
32+
cycles_x2);
3533
#else
3634
uint64_t cycles;
3735
asm volatile("rdcycle %0" : "=r"(cycles));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool ExegesisRISCVTarget::checkOpcodeSupported(
103103
FeatureBitset RequiredFeatures = RISCV_MC::computeRequiredFeatures(Opcode);
104104
FeatureBitset MissingFeatures =
105105
(AvailableFeatures & RequiredFeatures) ^ RequiredFeatures;
106-
return MissingFeatures.none();
106+
return !(MissingFeatures.none());
107107
}
108108

109109
#define GET_REGISTER_MATCHER

llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ computeAliasingInstructions(const LLVMState &State, const Instruction *Instr,
5252
continue;
5353
if (OtherOpcode == Instr->Description.getOpcode())
5454
continue;
55-
if (!State.getExegesisTarget().checkOpcodeSupported(
55+
if (State.getExegesisTarget().checkOpcodeSupported(
5656
OtherOpcode, State.getSubtargetInfo()))
5757
continue;
5858
const Instruction &OtherInstr = State.getIC().getInstr(OtherOpcode);

llvm/tools/llvm-exegesis/lib/Target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ExegesisTarget {
8888

8989
virtual bool checkOpcodeSupported(int Opcode,
9090
const MCSubtargetInfo &SI) const {
91-
return true;
91+
return false;
9292
}
9393

9494
// Find register by name, NoRegister if not found.

0 commit comments

Comments
 (0)