1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
14 #include <benchmark/benchmark.h>
15 #include "test_macros.h"
17 void run_sizes(auto benchmark
) {
62 static void BM_std_min(benchmark::State
& state
) {
63 std::vector
<T
> vec(state
.range(), 3);
65 for (auto _
: state
) {
66 benchmark::DoNotOptimize(vec
);
67 benchmark::DoNotOptimize(std::ranges::min(vec
));
70 BENCHMARK(BM_std_min
<char>)->Apply(run_sizes
);
71 BENCHMARK(BM_std_min
<short>)->Apply(run_sizes
);
72 BENCHMARK(BM_std_min
<int>)->Apply(run_sizes
);
73 BENCHMARK(BM_std_min
<long long>)->Apply(run_sizes
);
74 #ifndef TEST_HAS_NO_INT128
75 BENCHMARK(BM_std_min
<__int128
>)->Apply(run_sizes
);
77 BENCHMARK(BM_std_min
<unsigned char>)->Apply(run_sizes
);
78 BENCHMARK(BM_std_min
<unsigned short>)->Apply(run_sizes
);
79 BENCHMARK(BM_std_min
<unsigned int>)->Apply(run_sizes
);
80 BENCHMARK(BM_std_min
<unsigned long long>)->Apply(run_sizes
);
81 #ifndef TEST_HAS_NO_INT128
82 BENCHMARK(BM_std_min
<unsigned __int128
>)->Apply(run_sizes
);