diff --git a/llvm/docs/CommandGuide/llvm-exegesis.rst b/llvm/docs/CommandGuide/llvm-exegesis.rst --- a/llvm/docs/CommandGuide/llvm-exegesis.rst +++ b/llvm/docs/CommandGuide/llvm-exegesis.rst @@ -196,13 +196,15 @@ In `analysis` mode, you also need to specify at least one of the `-analysis-clusters-output-file=` and `-analysis-inconsistencies-output-file=`. -.. option:: --skip-measurements +.. option:: --benchmark-phase=[skip-codegen|skip-full-codegen|skip-measurements|measure] By default, when `-mode=` is specified, the generated snippet will be executed and measured, and that requires that we are running on the hardware for which the snippet was generated, and that supports performance measurements. But sometimes, you just want to generate snippets, and this is exactly what - this options allows one to do. + this options allows one to do. It's possible to also skip target machine code + generation for the snippets that would normally be executed and measured, + or skip all target machine code generation. .. option:: -x86-lbr-sample-period= diff --git a/llvm/test/tools/llvm-exegesis/PowerPC/latency-by-opcode-name.s b/llvm/test/tools/llvm-exegesis/PowerPC/latency-by-opcode-name.s --- a/llvm/test/tools/llvm-exegesis/PowerPC/latency-by-opcode-name.s +++ b/llvm/test/tools/llvm-exegesis/PowerPC/latency-by-opcode-name.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --skip-measurements -mode=latency -opcode-name=ADD8 | FileCheck %s +# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --benchmark-phase=skip-measurements -mode=latency -opcode-name=ADD8 | FileCheck %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s b/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s --- a/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s +++ b/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s @@ -1,3 +1,3 @@ -# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --skip-measurements -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --benchmark-phase=skip-measurements -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s CHECK: Unsupported opcode: isPseudo/usesCustomInserter diff --git a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-PBLENDVBrr0.s b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-PBLENDVBrr0.s --- a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-PBLENDVBrr0.s +++ b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-PBLENDVBrr0.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -x86-disable-upper-sse-registers -opcode-name=PBLENDVBrr0 -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --benchmark-phase=skip-measurements -x86-disable-upper-sse-registers -opcode-name=PBLENDVBrr0 -repetition-mode=loop | FileCheck %s CHECK: --- CHECK-NEXT: mode: inverse_throughput diff --git a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-by-opcode-name.s b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-by-opcode-name.s --- a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-by-opcode-name.s +++ b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-by-opcode-name.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s CHECK: --- CHECK-NEXT: mode: inverse_throughput diff --git a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-disable-upper-sse-registers.s b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-disable-upper-sse-registers.s --- a/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-disable-upper-sse-registers.s +++ b/llvm/test/tools/llvm-exegesis/X86/inverse_throughput/inverse_throughput-disable-upper-sse-registers.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -x86-disable-upper-sse-registers -opcode-name=ADDPSrr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --benchmark-phase=skip-measurements -x86-disable-upper-sse-registers -opcode-name=ADDPSrr -repetition-mode=loop | FileCheck %s CHECK: --- CHECK-NEXT: mode: inverse_throughput diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/dump-object-to-disk.s b/llvm/test/tools/llvm-exegesis/X86/latency/dump-object-to-disk.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/dump-object-to-disk.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/dump-object-to-disk.s @@ -1,9 +1,23 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-ON -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-ON -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate 2>&1 | FileCheck %s --check-prefix=CHECK-OFF -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-ON +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-ON +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=duplicate 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADDPSrr -repetition-mode=loop 2>&1 | FileCheck %s --check-prefix=CHECK-OFF + +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=ADDPSrr -repetition-mode=loop 2>&1 | FileCheck %s --check-prefix=CHECK-OFF + +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=1 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=loop -dump-object-to-disk=0 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=duplicate 2>&1 | FileCheck %s --check-prefix=CHECK-OFF +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=ADDPSrr -repetition-mode=loop 2>&1 | FileCheck %s --check-prefix=CHECK-OFF CHECK-ON: Check generated assembly with CHECK-OFF-NOT: Check generated assembly with diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-CMOV32rr.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-CMOV32rr.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-CMOV32rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-CMOV32rr.s @@ -1,6 +1,6 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CMOV32rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CMOV32rr -repetition-mode=loop | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CMOV32rr -repetition-mode=min | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=CMOV32rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=CMOV32rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=CMOV32rr -repetition-mode=min | FileCheck %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-CVTSD2SI64rr.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-CVTSD2SI64rr.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-CVTSD2SI64rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-CVTSD2SI64rr.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CVTSD2SI64rr -repetition-mode=loop --max-configs-per-opcode=8192 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=CVTSD2SI64rr -repetition-mode=loop --max-configs-per-opcode=8192 | FileCheck %s # We used to fail to setup the snippet, and that disabled liveness tracking # which we'd then tried to access during this run-line. diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-IN16rr.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-IN16rr.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-IN16rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-IN16rr.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=IN16rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=IN16rr -repetition-mode=duplicate | FileCheck %s # FIXME: Sometimes fails with: 'unimplemented operand type' # ALLOW_RETRIES: 2 diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64_32r.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64_32r.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64_32r.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64_32r.s @@ -1,16 +1,16 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck --check-prefix CHECK-COUNTS %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck --check-prefix CHECK-COUNTS %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck --check-prefix CHECK-COUNTS %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck --check-prefix CHECK-COUNTS %s ## Intentionally run llvm-exegesis twice per output! -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 --benchmarks-file=%t.duplicate.yaml -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 --benchmarks-file=%t.duplicate.yaml +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 --benchmarks-file=%t.duplicate.yaml +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 --benchmarks-file=%t.duplicate.yaml # RUN: FileCheck --input-file %t.duplicate.yaml %s # RUN: FileCheck --input-file %t.duplicate.yaml --check-prefix CHECK-COUNTS %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 --benchmarks-file=%t.loop.yaml -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 --benchmarks-file=%t.loop.yaml +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 --benchmarks-file=%t.loop.yaml +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 --benchmarks-file=%t.loop.yaml # RUN: FileCheck --input-file %t.loop.yaml %s # RUN: FileCheck --input-file %t.loop.yaml --check-prefix CHECK-COUNTS %s diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64r.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64r.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64r.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64r.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SBB8rr.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SBB8rr.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SBB8rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SBB8rr.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SBB8rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SBB8rr -repetition-mode=loop | FileCheck %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SETCCr-cond-codes-sweep.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SETCCr-cond-codes-sweep.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SETCCr-cond-codes-sweep.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SETCCr-cond-codes-sweep.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=1 | FileCheck %s --check-prefix=CHECK -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=256 | FileCheck %s --check-prefix=SWEEP +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=1 | FileCheck %s --check-prefix=CHECK +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=256 | FileCheck %s --check-prefix=SWEEP CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SQRTSSr.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SQRTSSr.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SQRTSSr.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SQRTSSr.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SQRTSSr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SQRTSSr -repetition-mode=loop | FileCheck %s # Check that the setup code for MXCSR does not crash the snippet. diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-SYSENTER.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SYSENTER -repetition-mode=duplicate 2>&1 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SYSENTER -repetition-mode=loop 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SYSENTER -repetition-mode=duplicate 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SYSENTER -repetition-mode=loop 2>&1 | FileCheck %s CHECK: SYSENTER: unsupported opcode diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-WRFSBASE.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-WRFSBASE.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-WRFSBASE.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-WRFSBASE.s @@ -1,6 +1,6 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=WRFSBASE -repetition-mode=duplicate 2>&1 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=WRFSBASE -repetition-mode=loop 2>&1 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=WRFSBASE64 -repetition-mode=duplicate 2>&1 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=WRFSBASE64 -repetition-mode=loop 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=WRFSBASE -repetition-mode=duplicate 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=WRFSBASE -repetition-mode=loop 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=WRFSBASE64 -repetition-mode=duplicate 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=WRFSBASE64 -repetition-mode=loop 2>&1 | FileCheck %s CHECK: WRFSBASE{{(64)?}}: unsupported opcode diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/latency-by-opcode-name.s b/llvm/test/tools/llvm-exegesis/X86/latency/latency-by-opcode-name.s --- a/llvm/test/tools/llvm-exegesis/X86/latency/latency-by-opcode-name.s +++ b/llvm/test/tools/llvm-exegesis/X86/latency/latency-by-opcode-name.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/max-configs.test b/llvm/test/tools/llvm-exegesis/X86/latency/max-configs.test --- a/llvm/test/tools/llvm-exegesis/X86/latency/max-configs.test +++ b/llvm/test/tools/llvm-exegesis/X86/latency/max-configs.test @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=1 | FileCheck -check-prefixes=CHECK,CHECK1 %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=2 | FileCheck -check-prefixes=CHECK,CHECK2 %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=1 | FileCheck -check-prefixes=CHECK,CHECK1 %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=2 | FileCheck -check-prefixes=CHECK,CHECK2 %s CHECK: --- CHECK-NEXT: mode: latency diff --git a/llvm/test/tools/llvm-exegesis/X86/latency/skip-codegen.s b/llvm/test/tools/llvm-exegesis/X86/latency/skip-codegen.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-exegesis/X86/latency/skip-codegen.s @@ -0,0 +1,11 @@ +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate | FileCheck %s --check-prefixes=CHECK,CHECK-CODEGEN +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-codegen -opcode-name=LEA64r -repetition-mode=duplicate | FileCheck %s --check-prefixes=CHECK,CHECK-NO-CODEGEN +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --benchmark-phase=skip-full-codegen -opcode-name=LEA64r -repetition-mode=duplicate | FileCheck %s --check-prefixes=CHECK,CHECK-CODEGEN + +CHECK: --- +CHECK-NEXT: mode: latency +CHECK-NEXT: key: +CHECK-NEXT: instructions: +CHECK-NEXT: LEA64r +CHECK-CODEGEN: assembled_snippet: {{[A-Z0-9]+}}{{$}} +CHECK-NO-CODEGEN: assembled_snippet: ''{{$}} diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mi8.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mi8.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mi8.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mi8.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mi8 -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mi8 -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32mi8 -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32mi8 -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mr.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mr.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mr.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mr.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32mr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32mr -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32rm.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32rm.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32rm.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32rm.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rm -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rm -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32rm -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32rm -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD_F32m.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD_F32m.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD_F32m.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD_F32m.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD_F32m -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD_F32m -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD_F32m -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD_F32m -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BEXTR32rm.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BEXTR32rm.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BEXTR32rm.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BEXTR32rm.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BEXTR32rm -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BEXTR32rm -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BEXTR32rm -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BEXTR32rm -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BSF16rm.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BSF16rm.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BSF16rm.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BSF16rm.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BSF16rm -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BSF16rm -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BSF16rm -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BSF16rm -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BTR64mr.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BTR64mr.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-BTR64mr.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-BTR64mr.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BTR64mr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BTR64mr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BTR64mr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=BTR64mr -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-CMOV16rm-noreg-serialization.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-CMOV16rm-noreg-serialization.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-CMOV16rm-noreg-serialization.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-CMOV16rm-noreg-serialization.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=CMOV16rm -benchmarks-file=- | FileCheck %s -check-prefixes=CHECK-YAML +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=CMOV16rm -benchmarks-file=- | FileCheck %s -check-prefixes=CHECK-YAML # https://bugs.llvm.org/show_bug.cgi?id=41448 # Verify that we correctly serialize RegNo 0 as %noreg, not as an empty string! diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-FLDENVm.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-FLDENVm.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-FLDENVm.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-FLDENVm.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=FLDENVm,FLDL2E -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=FLDENVm,FLDL2E -repetition-mode=duplicate | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-HLT.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-HLT.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-HLT.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-HLT.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops -skip-measurements --dump-object-to-disk=0 --repetition-mode=loop --loop-body-size=1000 --result-aggregation-mode=min --opcode-name=HLT --max-configs-per-opcode=8192 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements --dump-object-to-disk=0 --repetition-mode=loop --loop-body-size=1000 --result-aggregation-mode=min --opcode-name=HLT --max-configs-per-opcode=8192 | FileCheck %s # By definition, loop repetitor can not be used for terminator instructions. # Just check that we do not crash. diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-LEA64r.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-LEA64r.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-LEA64r.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-LEA64r.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s CHECK: --- CHECK-NEXT: mode: uops diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-POPCNT32rr.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-POPCNT32rr.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-POPCNT32rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-POPCNT32rr.s @@ -1,4 +1,4 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=POPCNT32rr 2>&1 | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=POPCNT32rr 2>&1 | FileCheck %s CHECK: --- CHECK-NEXT: mode: uops diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-STD.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-STD.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-STD.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-STD.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=STD -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=STD -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=STD -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=STD -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-VFMADDSS4rm.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-VFMADDSS4rm.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-VFMADDSS4rm.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-VFMADDSS4rm.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-XCHG64rr.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-XCHG64rr.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-XCHG64rr.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-XCHG64rr.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=XCHG64rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=XCHG64rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=XCHG64rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=XCHG64rr -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-by-opcode-name.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-by-opcode-name.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-by-opcode-name.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-by-opcode-name.s @@ -1,5 +1,5 @@ -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s -# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s +# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s CHECK: mode: uops CHECK-NEXT: key: diff --git a/llvm/test/tools/llvm-exegesis/X86/uops/uops-misspelled-div.s b/llvm/test/tools/llvm-exegesis/X86/uops/uops-misspelled-div.s --- a/llvm/test/tools/llvm-exegesis/X86/uops/uops-misspelled-div.s +++ b/llvm/test/tools/llvm-exegesis/X86/uops/uops-misspelled-div.s @@ -1,4 +1,4 @@ -# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -snippets-file=%s 2>&1 | FileCheck %s +# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --benchmark-phase=skip-measurements -snippets-file=%s 2>&1 | FileCheck %s # llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-DEFREG CL 1 # llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-DEFREG AX 1 diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h @@ -34,6 +34,13 @@ namespace exegesis { +enum class BenchmarkPhaseSelectorE { + StopBeforeAllCodegen, + StopBeforeFullCodegen, + StopBeforeMeasurements, + Measure, +}; + struct InstructionBenchmarkKey { // The LLVM opcode name. std::vector Instructions; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -36,7 +36,7 @@ public: explicit BenchmarkRunner(const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements); + BenchmarkPhaseSelectorE BenchmarkPhaseSelector); virtual ~BenchmarkRunner(); @@ -98,7 +98,7 @@ protected: const LLVMState &State; const InstructionBenchmark::ModeE Mode; - const bool BenchmarkSkipMeasurements; + const BenchmarkPhaseSelectorE BenchmarkPhaseSelector; private: virtual Expected> diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -31,9 +31,8 @@ BenchmarkRunner::BenchmarkRunner(const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements) - : State(State), Mode(Mode), - BenchmarkSkipMeasurements(BenchmarkSkipMeasurements), + BenchmarkPhaseSelectorE BenchmarkPhaseSelector) + : State(State), Mode(Mode), BenchmarkPhaseSelector(BenchmarkPhaseSelector), Scratch(std::make_unique()) {} BenchmarkRunner::~BenchmarkRunner() = default; @@ -171,9 +170,9 @@ // Assemble at least kMinInstructionsForSnippet instructions by repeating // the snippet for debug/analysis. This is so that the user clearly // understands that the inside instructions are repeated. - const int MinInstructionsForSnippet = 4 * Instructions.size(); - const int LoopBodySizeForSnippet = 2 * Instructions.size(); - { + if (BenchmarkPhaseSelector > BenchmarkPhaseSelectorE::StopBeforeAllCodegen) { + const int MinInstructionsForSnippet = 4 * Instructions.size(); + const int LoopBodySizeForSnippet = 2 * Instructions.size(); auto Snippet = assembleSnippet(BC, Repetitor, MinInstructionsForSnippet, LoopBodySizeForSnippet); if (Error E = Snippet.takeError()) @@ -186,7 +185,7 @@ // Assemble NumRepetitions instructions repetitions of the snippet for // measurements. - { + if (BenchmarkPhaseSelector > BenchmarkPhaseSelectorE::StopBeforeFullCodegen) { auto Snippet = assembleSnippet(BC, Repetitor, InstrBenchmark.NumRepetitions, LoopBodySize); if (Error E = Snippet.takeError()) @@ -203,7 +202,8 @@ InstructionBenchmark &InstrBenchmark = RC.InstrBenchmark; object::OwningBinary &ObjectFile = RC.ObjectFile; - if (DumpObjectToDisk) { + if (DumpObjectToDisk && + BenchmarkPhaseSelector > BenchmarkPhaseSelectorE::StopBeforeFullCodegen) { auto ObjectFilePath = writeObjectFile(ObjectFile.getBinary()->getData()); if (Error E = ObjectFilePath.takeError()) { InstrBenchmark.Error = toString(std::move(E)); @@ -213,9 +213,8 @@ << *ObjectFilePath << "\n"; } - if (BenchmarkSkipMeasurements) { - InstrBenchmark.Error = - "in --skip-measurements mode, actual measurements skipped."; + if (BenchmarkPhaseSelector < BenchmarkPhaseSelectorE::Measure) { + InstrBenchmark.Error = "actual measurements skipped."; return std::move(InstrBenchmark); } diff --git a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h --- a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h @@ -23,7 +23,7 @@ public: LatencyBenchmarkRunner( const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode); ~LatencyBenchmarkRunner() override; diff --git a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp --- a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp @@ -20,9 +20,9 @@ LatencyBenchmarkRunner::LatencyBenchmarkRunner( const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAgg) - : BenchmarkRunner(State, Mode, BenchmarkSkipMeasurements) { + : BenchmarkRunner(State, Mode, BenchmarkPhaseSelector) { assert((Mode == InstructionBenchmark::Latency || Mode == InstructionBenchmark::InverseThroughput) && "invalid mode"); diff --git a/llvm/tools/llvm-exegesis/lib/Target.h b/llvm/tools/llvm-exegesis/lib/Target.h --- a/llvm/tools/llvm-exegesis/lib/Target.h +++ b/llvm/tools/llvm-exegesis/lib/Target.h @@ -160,7 +160,7 @@ // Creates a benchmark runner for the given mode. Expected> createBenchmarkRunner( InstructionBenchmark::ModeE Mode, const LLVMState &State, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode = InstructionBenchmark::Min) const; @@ -199,10 +199,10 @@ const LLVMState &State, const SnippetGenerator::Options &Opts) const; std::unique_ptr virtual createLatencyBenchmarkRunner( const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode) const; std::unique_ptr virtual createUopsBenchmarkRunner( - const LLVMState &State, bool BenchmarkSkipMeasurements, + const LLVMState &State, BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode) const; const ExegesisTarget *Next = nullptr; diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp --- a/llvm/tools/llvm-exegesis/lib/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/Target.cpp @@ -74,7 +74,7 @@ Expected> ExegesisTarget::createBenchmarkRunner( InstructionBenchmark::ModeE Mode, const LLVMState &State, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode) const { PfmCountersInfo PfmCounters = State.getPfmCounters(); switch (Mode) { @@ -82,7 +82,8 @@ return nullptr; case InstructionBenchmark::Latency: case InstructionBenchmark::InverseThroughput: - if (!BenchmarkSkipMeasurements && !PfmCounters.CycleCounter) { + if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure && + !PfmCounters.CycleCounter) { const char *ModeName = Mode == InstructionBenchmark::Latency ? "latency" : "inverse_throughput"; @@ -94,16 +95,16 @@ "can pass --skip-measurements to skip the actual " "benchmarking.")); } - return createLatencyBenchmarkRunner(State, Mode, BenchmarkSkipMeasurements, + return createLatencyBenchmarkRunner(State, Mode, BenchmarkPhaseSelector, ResultAggMode); case InstructionBenchmark::Uops: - if (!BenchmarkSkipMeasurements && !PfmCounters.UopsCounter && - !PfmCounters.IssueCounters) + if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure && + !PfmCounters.UopsCounter && !PfmCounters.IssueCounters) return make_error( "can't run 'uops' mode, sched model does not define uops or issue " "counters. You can pass --skip-measurements to skip the actual " "benchmarking."); - return createUopsBenchmarkRunner(State, BenchmarkSkipMeasurements, + return createUopsBenchmarkRunner(State, BenchmarkPhaseSelector, ResultAggMode); } return nullptr; @@ -121,17 +122,16 @@ std::unique_ptr ExegesisTarget::createLatencyBenchmarkRunner( const LLVMState &State, InstructionBenchmark::ModeE Mode, - bool BenchmarkSkipMeasurements, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE ResultAggMode) const { return std::make_unique( - State, Mode, BenchmarkSkipMeasurements, ResultAggMode); + State, Mode, BenchmarkPhaseSelector, ResultAggMode); } std::unique_ptr ExegesisTarget::createUopsBenchmarkRunner( - const LLVMState &State, bool BenchmarkSkipMeasurements, + const LLVMState &State, BenchmarkPhaseSelectorE BenchmarkPhaseSelector, InstructionBenchmark::ResultAggregationModeE /*unused*/) const { - return std::make_unique(State, - BenchmarkSkipMeasurements); + return std::make_unique(State, BenchmarkPhaseSelector); } static_assert(std::is_pod::value, diff --git a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h --- a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h @@ -21,9 +21,10 @@ class UopsBenchmarkRunner : public BenchmarkRunner { public: - UopsBenchmarkRunner(const LLVMState &State, bool BenchmarkSkipMeasurements) + UopsBenchmarkRunner(const LLVMState &State, + BenchmarkPhaseSelectorE BenchmarkPhaseSelector) : BenchmarkRunner(State, InstructionBenchmark::Uops, - BenchmarkSkipMeasurements) {} + BenchmarkPhaseSelector) {} ~UopsBenchmarkRunner() override; static constexpr const size_t kMinNumDifferentAddresses = 6; diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp --- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp +++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp @@ -116,10 +116,30 @@ cl::desc("Produce progress indicator when performing measurements"), cl::cat(BenchmarkOptions), cl::init(false)); -static cl::opt BenchmarkSkipMeasurements( - "skip-measurements", - cl::desc("do everything except actually performing the measurements"), - cl::cat(BenchmarkOptions), cl::init(false)); +static cl::opt BenchmarkPhaseSelector( + "benchmark-phase", + cl::desc( + "it is possible to stop the benchmarking process after some phase"), + cl::cat(BenchmarkOptions), + cl::values( + clEnumValN(exegesis::BenchmarkPhaseSelectorE::StopBeforeAllCodegen, + "skip-codegen", + "come up with the instruction sequence that can be " + "assembled into a runnable snippet to measure the " + "characteristic, but stop after that"), + clEnumValN(exegesis::BenchmarkPhaseSelectorE::StopBeforeFullCodegen, + "skip-full-codegen", + "in addition to skip-codegen, do assemble a miniature " + "snippet for illustrative purposes, " + "but stop after that"), + clEnumValN(exegesis::BenchmarkPhaseSelectorE::StopBeforeMeasurements, + "skip-measurements", + "in addition to skip-full-codegen, also assemble the final " + "snippet to be run and measured, but stop after that"), + clEnumValN(exegesis::BenchmarkPhaseSelectorE::Measure, "measure", + "do everything, including actually measuring the snippets " + "(default)")), + cl::init(exegesis::BenchmarkPhaseSelectorE::Measure)); static cl::opt NumRepetitions("num-repetitions", @@ -386,7 +406,7 @@ } void benchmarkMain() { - if (!BenchmarkSkipMeasurements) { + if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure) { #ifndef HAVE_LIBPFM ExitWithError( "benchmarking unavailable, LLVM was built without libpfm. You can pass " @@ -405,12 +425,12 @@ // Preliminary check to ensure features needed for requested // benchmark mode are present on target CPU and/or OS. - if (!BenchmarkSkipMeasurements) + if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure) ExitOnErr(State.getExegesisTarget().checkFeatureSupport()); const std::unique_ptr Runner = ExitOnErr(State.getExegesisTarget().createBenchmarkRunner( - BenchmarkMode, State, BenchmarkSkipMeasurements, ResultAggMode)); + BenchmarkMode, State, BenchmarkPhaseSelector, ResultAggMode)); if (!Runner) { ExitWithError("cannot create benchmark runner"); }