Skip to content

Commit de1faa0

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:c5492e3c65e4 into amd-gfx:88041b2310c7
Local branch amd-gfx 88041b2 Merged main:eaf67e062c09 into amd-gfx:02f0342f80c4 Remote branch main c5492e3 [libc++] Add a benchmark for std::num_get
2 parents 88041b2 + c5492e3 commit de1faa0

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#include <ios>
11+
#include <locale>
12+
13+
#include <benchmark/benchmark.h>
14+
15+
struct num_get : std::num_get<char, std::string::iterator> {};
16+
17+
template <class T>
18+
void BM_num_get(benchmark::State& state) {
19+
auto val = std::string("123");
20+
std::ios ios(nullptr);
21+
num_get np;
22+
23+
for (auto _ : state) {
24+
benchmark::DoNotOptimize(val);
25+
T out;
26+
std::ios_base::iostate err = ios.goodbit;
27+
benchmark::DoNotOptimize(np.get(val.begin(), val.end(), ios, err, out));
28+
benchmark::DoNotOptimize(out);
29+
}
30+
}
31+
32+
BENCHMARK(BM_num_get<bool>);
33+
BENCHMARK(BM_num_get<long>);
34+
BENCHMARK(BM_num_get<long long>);
35+
BENCHMARK(BM_num_get<unsigned short>);
36+
BENCHMARK(BM_num_get<unsigned int>);
37+
BENCHMARK(BM_num_get<unsigned long>);
38+
BENCHMARK(BM_num_get<unsigned long long>);
39+
BENCHMARK(BM_num_get<float>);
40+
BENCHMARK(BM_num_get<double>);
41+
BENCHMARK(BM_num_get<long double>);
42+
BENCHMARK(BM_num_get<void*>);
43+
44+
BENCHMARK_MAIN();

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 522254
19+
#define LLVM_MAIN_REVISION 522255
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

0 commit comments

Comments
 (0)