[InstCombine] Signed saturation patterns
[llvm-complete.git] / utils / benchmark / src / benchmark_register.h
blob0705e219f2fa2a7d11a758a354386a40adc8db43
1 #ifndef BENCHMARK_REGISTER_H
2 #define BENCHMARK_REGISTER_H
4 #include <vector>
6 #include "check.h"
8 template <typename T>
9 void AddRange(std::vector<T>* dst, T lo, T hi, int mult) {
10 CHECK_GE(lo, 0);
11 CHECK_GE(hi, lo);
12 CHECK_GE(mult, 2);
14 // Add "lo"
15 dst->push_back(lo);
17 static const T kmax = std::numeric_limits<T>::max();
19 // Now space out the benchmarks in multiples of "mult"
20 for (T i = 1; i < kmax / mult; i *= mult) {
21 if (i >= hi) break;
22 if (i > lo) {
23 dst->push_back(i);
27 // Add "hi" (if different from "lo")
28 if (hi != lo) {
29 dst->push_back(hi);
33 #endif // BENCHMARK_REGISTER_H