Skip to content

Commit 9292983

Browse files
committedOct 1, 2019
[llvm-mca] Add a -mattr flag
This adds a -mattr flag to llvm-mca, for cases where the -mcpu option does not contain all optional features. Differential Revision: https://reviews.llvm.org/D68190 llvm-svn: 373358
1 parent 42ec0b7 commit 9292983

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
2+
# RUN: llvm-mca -mtriple=arm-none-none-eabi -mcpu=cortex-m4 -mattr=+fp64 -instruction-tables < %s | FileCheck %s
3+
4+
vadd.f32 s0, s2, s2
5+
vadd.f64 d0, d2, d2
6+
7+
# CHECK: Instruction Info:
8+
# CHECK-NEXT: [1]: #uOps
9+
# CHECK-NEXT: [2]: Latency
10+
# CHECK-NEXT: [3]: RThroughput
11+
# CHECK-NEXT: [4]: MayLoad
12+
# CHECK-NEXT: [5]: MayStore
13+
# CHECK-NEXT: [6]: HasSideEffects (U)
14+
15+
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
16+
# CHECK-NEXT: 1 1 1.00 vadd.f32 s0, s2, s2
17+
# CHECK-NEXT: 1 1 1.00 vadd.f64 d0, d2, d2
18+
19+
# CHECK: Resources:
20+
# CHECK-NEXT: [0] - M4Unit
21+
22+
# CHECK: Resource pressure per iteration:
23+
# CHECK-NEXT: [0]
24+
# CHECK-NEXT: 2.00
25+
26+
# CHECK: Resource pressure by instruction:
27+
# CHECK-NEXT: [0] Instructions:
28+
# CHECK-NEXT: 1.00 vadd.f32 s0, s2, s2
29+
# CHECK-NEXT: 1.00 vadd.f64 d0, d2, d2

‎llvm/tools/llvm-mca/llvm-mca.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ static cl::opt<std::string>
8989
cl::desc("Target a specific cpu type (-mcpu=help for details)"),
9090
cl::value_desc("cpu-name"), cl::cat(ToolOptions), cl::init("native"));
9191

92+
static cl::opt<std::string>
93+
MATTR("mattr",
94+
cl::desc("Additional target features."),
95+
cl::cat(ToolOptions));
96+
9297
static cl::opt<int>
9398
OutputAsmVariant("output-asm-variant",
9499
cl::desc("Syntax variant to use for output printing"),
@@ -322,7 +327,7 @@ int main(int argc, char **argv) {
322327
MCPU = llvm::sys::getHostCPUName();
323328

324329
std::unique_ptr<MCSubtargetInfo> STI(
325-
TheTarget->createMCSubtargetInfo(TripleName, MCPU, /* FeaturesStr */ ""));
330+
TheTarget->createMCSubtargetInfo(TripleName, MCPU, MATTR));
326331
if (!STI->isCPUStringValid(MCPU))
327332
return 1;
328333

0 commit comments

Comments
 (0)
Please sign in to comment.