CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#include <benchmark/benchmark.h>
|
|
|
|
#ifdef __clang__
|
|
#pragma clang diagnostic ignored "-Wreturn-type"
|
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
|
#endif
|
|
|
|
// clang-format off
|
|
extern "C" {
|
|
extern int ExternInt;
|
|
benchmark::State& GetState();
|
|
void Fn();
|
|
}
|
|
// clang-format on
|
|
|
|
using benchmark::State;
|
|
|
|
// CHECK-LABEL: test_for_auto_loop:
|
|
extern "C" int test_for_auto_loop() {
|
|
State& S = GetState();
|
|
int x = 42;
|
|
// CHECK: [[CALL:call(q)*]] _ZN9benchmark5State16StartKeepRunningEv
|
|
// CHECK-NEXT: testq %rbx, %rbx
|
|
// CHECK-NEXT: je [[LOOP_END:.*]]
|
|
|
|
for (auto _ : S) {
|
|
// CHECK: .L[[LOOP_HEAD:[a-zA-Z0-9_]+]]:
|
|
// CHECK-GNU-NEXT: subq $1, %rbx
|
|
// CHECK-CLANG-NEXT: {{(addq \$1, %rax|incq %rax|addq \$-1, %rbx)}}
|
|
// CHECK-NEXT: jne .L[[LOOP_HEAD]]
|
|
benchmark::DoNotOptimize(x);
|
|
}
|
|
// CHECK: [[LOOP_END]]:
|
|
// CHECK: [[CALL]] _ZN9benchmark5State17FinishKeepRunningEv
|
|
|
|
// CHECK: movl $101, %eax
|
|
// CHECK: ret
|
|
return 101;
|
|
}
|
|
|
|
// CHECK-LABEL: test_while_loop:
|
|
extern "C" int test_while_loop() {
|
|
State& S = GetState();
|
|
int x = 42;
|
|
|
|
// CHECK: j{{(e|mp)}} .L[[LOOP_HEADER:[a-zA-Z0-9_]+]]
|
|
// CHECK-NEXT: .L[[LOOP_BODY:[a-zA-Z0-9_]+]]:
|
|
while (S.KeepRunning()) {
|
|
// CHECK-GNU-NEXT: subq $1, %[[IREG:[a-z]+]]
|
|
// CHECK-CLANG-NEXT: {{(addq \$-1,|decq)}} %[[IREG:[a-z]+]]
|
|
// CHECK: movq %[[IREG]], [[DEST:.*]]
|
|
benchmark::DoNotOptimize(x);
|
|
}
|
|
// CHECK-DAG: movq [[DEST]], %[[IREG]]
|
|
// CHECK-DAG: testq %[[IREG]], %[[IREG]]
|
|
// CHECK-DAG: jne .L[[LOOP_BODY]]
|
|
// CHECK-DAG: .L[[LOOP_HEADER]]:
|
|
|
|
// CHECK: cmpb $0
|
|
// CHECK-NEXT: jne .L[[LOOP_END:[a-zA-Z0-9_]+]]
|
|
// CHECK: [[CALL:call(q)*]] _ZN9benchmark5State16StartKeepRunningEv
|
|
|
|
// CHECK: .L[[LOOP_END]]:
|
|
// CHECK: [[CALL]] _ZN9benchmark5State17FinishKeepRunningEv
|
|
|
|
// CHECK: movl $101, %eax
|
|
// CHECK: ret
|
|
return 101;
|
|
}
|