Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / llvm / benchmarks / GetIntrinsicForClangBuiltin.cpp
blobfa9c528424c95f7c5adc4404b5134331cfff3a85
1 #include "benchmark/benchmark.h"
2 #include "llvm/IR/Intrinsics.h"
4 using namespace llvm;
5 using namespace Intrinsic;
7 // Benchmark intrinsic lookup from a variety of targets.
8 static void BM_GetIntrinsicForClangBuiltin(benchmark::State &state) {
9 static const char *Builtins[] = {
10 "__builtin_adjust_trampoline",
11 "__builtin_trap",
12 "__builtin_arm_ttest",
13 "__builtin_amdgcn_cubetc",
14 "__builtin_amdgcn_udot2",
15 "__builtin_arm_stc",
16 "__builtin_bpf_compare",
17 "__builtin_HEXAGON_A2_max",
18 "__builtin_lasx_xvabsd_b",
19 "__builtin_mips_dlsa",
20 "__nvvm_floor_f",
21 "__builtin_altivec_vslb",
22 "__builtin_r600_read_tgid_x",
23 "__builtin_riscv_aes64im",
24 "__builtin_s390_vcksm",
25 "__builtin_ve_vl_pvfmksge_Mvl",
26 "__builtin_ia32_axor64",
27 "__builtin_bitrev",
29 static const char *Targets[] = {"", "aarch64", "amdgcn", "mips",
30 "nvvm", "r600", "riscv"};
32 for (auto _ : state) {
33 for (auto Builtin : Builtins)
34 for (auto Target : Targets)
35 getIntrinsicForClangBuiltin(Target, Builtin);
39 static void
40 BM_GetIntrinsicForClangBuiltinHexagonFirst(benchmark::State &state) {
41 // Exercise the worst case by looking for the first builtin for a target
42 // that has a lot of builtins.
43 for (auto _ : state)
44 getIntrinsicForClangBuiltin("hexagon", "__builtin_HEXAGON_A2_abs");
47 BENCHMARK(BM_GetIntrinsicForClangBuiltin);
48 BENCHMARK(BM_GetIntrinsicForClangBuiltinHexagonFirst);
50 BENCHMARK_MAIN();