[libcxx-commits] [libcxx] b2d2494 - [libc++] Make benchmarks forward-compatible with the test suite (#114502)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 5 06:08:04 PST 2024


Author: Louis Dionne
Date: 2024-11-05T09:08:00-05:00
New Revision: b2d2494731976ab7aa9702f3134472db694b9332

URL: https://github.com/llvm/llvm-project/commit/b2d2494731976ab7aa9702f3134472db694b9332
DIFF: https://github.com/llvm/llvm-project/commit/b2d2494731976ab7aa9702f3134472db694b9332.diff

LOG: [libc++] Make benchmarks forward-compatible with the test suite (#114502)

This patch fixes warnings and errors that come up when running the
benchmarks as part of the test suite. It also adds the necessary Lit
annotations to make it pass in various configurations and increases the
portability of the benchmarks.

Added: 
    

Modified: 
    libcxx/test/benchmarks/CartesianBenchmarks.h
    libcxx/test/benchmarks/ContainerBenchmarks.h
    libcxx/test/benchmarks/VariantBenchmarks.h
    libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
    libcxx/test/benchmarks/algorithms/count.bench.cpp
    libcxx/test/benchmarks/algorithms/equal.bench.cpp
    libcxx/test/benchmarks/algorithms/fill.bench.cpp
    libcxx/test/benchmarks/algorithms/find.bench.cpp
    libcxx/test/benchmarks/algorithms/for_each.bench.cpp
    libcxx/test/benchmarks/algorithms/lexicographical_compare.bench.cpp
    libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
    libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/min.bench.cpp
    libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
    libcxx/test/benchmarks/algorithms/minmax.bench.cpp
    libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
    libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
    libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
    libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp
    libcxx/test/benchmarks/algorithms/sort.bench.cpp
    libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
    libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
    libcxx/test/benchmarks/allocation.bench.cpp
    libcxx/test/benchmarks/atomic_wait.bench.cpp
    libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
    libcxx/test/benchmarks/deque.bench.cpp
    libcxx/test/benchmarks/deque_iterator.bench.cpp
    libcxx/test/benchmarks/exception_ptr.bench.cpp
    libcxx/test/benchmarks/filesystem.bench.cpp
    libcxx/test/benchmarks/format.bench.cpp
    libcxx/test/benchmarks/format/write_double_comparison.bench.cpp
    libcxx/test/benchmarks/format/write_int_comparison.bench.cpp
    libcxx/test/benchmarks/format/write_string_comparison.bench.cpp
    libcxx/test/benchmarks/format_to.bench.cpp
    libcxx/test/benchmarks/format_to_n.bench.cpp
    libcxx/test/benchmarks/formatted_size.bench.cpp
    libcxx/test/benchmarks/formatter_float.bench.cpp
    libcxx/test/benchmarks/formatter_int.bench.cpp
    libcxx/test/benchmarks/function.bench.cpp
    libcxx/test/benchmarks/hash.bench.cpp
    libcxx/test/benchmarks/join_view.bench.cpp
    libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
    libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
    libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
    libcxx/test/benchmarks/map.bench.cpp
    libcxx/test/benchmarks/monotonic_buffer.bench.cpp
    libcxx/test/benchmarks/numeric/gcd.bench.cpp
    libcxx/test/benchmarks/ordered_set.bench.cpp
    libcxx/test/benchmarks/random.bench.cpp
    libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
    libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
    libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
    libcxx/test/benchmarks/stop_token.bench.cpp
    libcxx/test/benchmarks/string.bench.cpp
    libcxx/test/benchmarks/stringstream.bench.cpp
    libcxx/test/benchmarks/system_error.bench.cpp
    libcxx/test/benchmarks/to_chars.bench.cpp
    libcxx/test/benchmarks/unordered_set_operations.bench.cpp
    libcxx/test/benchmarks/variant_visit_1.bench.cpp
    libcxx/test/benchmarks/variant_visit_2.bench.cpp
    libcxx/test/benchmarks/variant_visit_3.bench.cpp
    libcxx/test/benchmarks/vector_operations.bench.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/benchmarks/CartesianBenchmarks.h b/libcxx/test/benchmarks/CartesianBenchmarks.h
index eca4e15cd009bc..c712230843ebf4 100644
--- a/libcxx/test/benchmarks/CartesianBenchmarks.h
+++ b/libcxx/test/benchmarks/CartesianBenchmarks.h
@@ -27,11 +27,11 @@ constexpr auto makeEnumValueTuple(std::index_sequence<Idxs...>) {
 }
 
 template <class B>
-static auto skip(const B& Bench, int) -> decltype(Bench.skip()) {
+auto skip(const B& Bench, int) -> decltype(Bench.skip()) {
   return Bench.skip();
 }
 template <class B>
-static auto skip(const B& Bench, char) {
+auto skip(const B&, char) {
   return false;
 }
 
@@ -51,7 +51,7 @@ void makeBenchmarkFromValues(const std::vector<std::tuple<Args...> >& A) {
 }
 
 template <template <class...> class B, class Args, class... U>
-void makeBenchmarkImpl(const Args& A, std::tuple<U...> t) {
+void makeBenchmarkImpl(const Args& A, std::tuple<U...>) {
   makeBenchmarkFromValues<B<U...> >(A);
 }
 

diff  --git a/libcxx/test/benchmarks/ContainerBenchmarks.h b/libcxx/test/benchmarks/ContainerBenchmarks.h
index 5404814e7599b3..742c848328604c 100644
--- a/libcxx/test/benchmarks/ContainerBenchmarks.h
+++ b/libcxx/test/benchmarks/ContainerBenchmarks.h
@@ -150,7 +150,7 @@ void BM_EmplaceDuplicate(benchmark::State& st, Container c, GenInputs gen) {
 }
 
 template <class Container, class GenInputs>
-static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
+void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
   auto in = gen(st.range(0));
   c.insert(in.begin(), in.end());
   benchmark::DoNotOptimize(&(*c.begin()));
@@ -164,7 +164,7 @@ static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
 }
 
 template <class Container, class GenInputs>
-static void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
+void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
   c.rehash(8);
   auto in = gen(st.range(0));
   c.insert(in.begin(), in.end());
@@ -179,7 +179,7 @@ static void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
 }
 
 template <class Container, class GenInputs>
-static void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
+void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
   auto in = gen(st.range(0));
   c.max_load_factor(3.0);
   c.insert(in.begin(), in.end());
@@ -193,7 +193,7 @@ static void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
 }
 
 template <class Container, class GenInputs>
-static void BM_Compare_same_container(benchmark::State& st, Container, GenInputs gen) {
+void BM_Compare_same_container(benchmark::State& st, Container, GenInputs gen) {
   auto in = gen(st.range(0));
   Container c1(in.begin(), in.end());
   Container c2 = c1;
@@ -208,7 +208,7 @@ static void BM_Compare_same_container(benchmark::State& st, Container, GenInputs
 }
 
 template <class Container, class GenInputs>
-static void BM_Compare_
diff erent_containers(benchmark::State& st, Container, GenInputs gen) {
+void BM_Compare_
diff erent_containers(benchmark::State& st, Container, GenInputs gen) {
   auto in1 = gen(st.range(0));
   auto in2 = gen(st.range(0));
   Container c1(in1.begin(), in1.end());

diff  --git a/libcxx/test/benchmarks/VariantBenchmarks.h b/libcxx/test/benchmarks/VariantBenchmarks.h
index ad36b59d2e879d..bb0c7142791507 100644
--- a/libcxx/test/benchmarks/VariantBenchmarks.h
+++ b/libcxx/test/benchmarks/VariantBenchmarks.h
@@ -35,7 +35,7 @@ static auto genVariants(std::index_sequence<Is...>) {
 
   std::array<V, N> result = {};
   for (auto& v : result) {
-    v = fs[getRandomInteger(0ul, sizeof...(Is) - 1)]();
+    v = fs[getRandomInteger(std::size_t(0), sizeof...(Is) - 1)]();
   }
 
   return result;

diff  --git a/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp b/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
index ed2e337fa6ea31..42ebce8ad2f4ad 100644
--- a/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <array>
 #include <cassert>

diff  --git a/libcxx/test/benchmarks/algorithms/count.bench.cpp b/libcxx/test/benchmarks/algorithms/count.bench.cpp
index 7370293fd6efd0..46b85e909efa5d 100644
--- a/libcxx/test/benchmarks/algorithms/count.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/count.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <cstring>

diff  --git a/libcxx/test/benchmarks/algorithms/equal.bench.cpp b/libcxx/test/benchmarks/algorithms/equal.bench.cpp
index 6d63d8c48ce1e0..2dc11585c15c7f 100644
--- a/libcxx/test/benchmarks/algorithms/equal.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/equal.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <vector>

diff  --git a/libcxx/test/benchmarks/algorithms/fill.bench.cpp b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
index 40f37425c394cf..c157b5e5c9862c 100644
--- a/libcxx/test/benchmarks/algorithms/fill.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <vector>

diff  --git a/libcxx/test/benchmarks/algorithms/find.bench.cpp b/libcxx/test/benchmarks/algorithms/find.bench.cpp
index 6ff2d95ab43533..43d103474ebdf0 100644
--- a/libcxx/test/benchmarks/algorithms/find.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/find.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <cstring>

diff  --git a/libcxx/test/benchmarks/algorithms/for_each.bench.cpp b/libcxx/test/benchmarks/algorithms/for_each.bench.cpp
index 7019dc13ca601a..554c9ec9930434 100644
--- a/libcxx/test/benchmarks/algorithms/for_each.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/for_each.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <deque>

diff  --git a/libcxx/test/benchmarks/algorithms/lexicographical_compare.bench.cpp b/libcxx/test/benchmarks/algorithms/lexicographical_compare.bench.cpp
index 0c545263109d29..e9d7710bf29c2e 100755
--- a/libcxx/test/benchmarks/algorithms/lexicographical_compare.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/lexicographical_compare.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <vector>

diff  --git a/libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp b/libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
index 3be5010f5bdf20..d9d57969df67a3 100644
--- a/libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <numeric>
 #include <random>

diff  --git a/libcxx/test/benchmarks/algorithms/make_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
index dade7b8273107a..b7320e17c3e500 100644
--- a/libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
index 48f34f8651b971..5991d2846aee4f 100644
--- a/libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/min.bench.cpp b/libcxx/test/benchmarks/algorithms/min.bench.cpp
index a09bd530d01207..ee426c7e727aa4 100644
--- a/libcxx/test/benchmarks/algorithms/min.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/min.bench.cpp
@@ -6,10 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <cassert>
 
 #include <benchmark/benchmark.h>
+#include "test_macros.h"
 
 void run_sizes(auto benchmark) {
   benchmark->Arg(1)
@@ -68,7 +71,9 @@ BENCHMARK(BM_std_min<char>)->Apply(run_sizes);
 BENCHMARK(BM_std_min<short>)->Apply(run_sizes);
 BENCHMARK(BM_std_min<int>)->Apply(run_sizes);
 BENCHMARK(BM_std_min<long long>)->Apply(run_sizes);
+#ifndef TEST_HAS_NO_INT128
 BENCHMARK(BM_std_min<__int128>)->Apply(run_sizes);
+#endif
 BENCHMARK(BM_std_min<unsigned char>)->Apply(run_sizes);
 BENCHMARK(BM_std_min<unsigned short>)->Apply(run_sizes);
 BENCHMARK(BM_std_min<unsigned int>)->Apply(run_sizes);

diff  --git a/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp b/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
index e2c64236561049..4dbfed66d0c2cf 100644
--- a/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/minmax.bench.cpp b/libcxx/test/benchmarks/algorithms/minmax.bench.cpp
index ca1cdb441deef7..7d7c74c9c96aa6 100644
--- a/libcxx/test/benchmarks/algorithms/minmax.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/minmax.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <cassert>
 

diff  --git a/libcxx/test/benchmarks/algorithms/mismatch.bench.cpp b/libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
index 791782879011e2..348009a230d6e1 100644
--- a/libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <random>

diff  --git a/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
index 26cdd25cce90d0..5fef52284239dd 100644
--- a/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
index 72541f70640f53..10254ac12cf56f 100644
--- a/libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: libcpp-has-no-incomplete-pstl
+
 #include <algorithm>
 #include <execution>
 

diff  --git a/libcxx/test/benchmarks/algorithms/push_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
index ba96fa1469e604..89d8122bd1dbe9 100644
--- a/libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
index f36ebff9009585..b98e17a00ef830 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <iterator>

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
index 049af7c2e15a35..c975d164c16d45 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <algorithm>
 #include <benchmark/benchmark.h>
 #include <iterator>

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
index 66a8335a8710c2..c04ea369fea0c9 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
index 01632c807c178d..b84d3c2cea765e 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
index bcc7a834a655ac..ab3ae6f7c30ae0 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
index 902f481228e466..8139ba32cb9747 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
index aeb2aedd34af33..d145a159a21fd3 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
index 62c607cf7a5ed6..90e9b9a6933f5f 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
index 88327483cf43c3..acc2f3f755fb86 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp b/libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp
index b3fb15fc77b318..9bde4bb29dc22f 100644
--- a/libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <cstdlib>
 #include <iterator>

diff  --git a/libcxx/test/benchmarks/algorithms/sort.bench.cpp b/libcxx/test/benchmarks/algorithms/sort.bench.cpp
index f87434b7797124..899272e34795fa 100644
--- a/libcxx/test/benchmarks/algorithms/sort.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/sort.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
index 1372b4d5c9ab7c..ee4b6bfc7387bf 100644
--- a/libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
index 024a036e0c2582..c68f73838c3199 100644
--- a/libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 
 #include "common.h"

diff  --git a/libcxx/test/benchmarks/allocation.bench.cpp b/libcxx/test/benchmarks/allocation.bench.cpp
index 1d0c71f5bec19e..66a9b88793412b 100644
--- a/libcxx/test/benchmarks/allocation.bench.cpp
+++ b/libcxx/test/benchmarks/allocation.bench.cpp
@@ -6,12 +6,18 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: -fsized-deallocation
+// ADDITIONAL_COMPILE_FLAGS: -fsized-deallocation
+
 #include "benchmark/benchmark.h"
 
 #include <cassert>
+#include <cstdlib>
 #include <new>
 #include <vector>
 
+#include "test_macros.h"
+
 struct PointerList {
   PointerList* Next = nullptr;
 };
@@ -26,6 +32,7 @@ struct NewWrapper {
   __attribute__((always_inline)) static void Deallocate(void* P, size_t) { ::operator delete(P); }
 };
 
+#ifdef TEST_COMPILER_CLANG
 struct BuiltinNewWrapper {
   __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); }
   __attribute__((always_inline)) static void Deallocate(void* P, size_t) { __builtin_operator_delete(P); }
@@ -35,6 +42,7 @@ struct BuiltinSizedNewWrapper {
   __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); }
   __attribute__((always_inline)) static void Deallocate(void* P, size_t N) { __builtin_operator_delete(P, N); }
 };
+#endif
 
 template <class AllocWrapper>
 static void BM_AllocateAndDeallocate(benchmark::State& st) {
@@ -93,11 +101,12 @@ static int RegisterAllocBenchmarks() {
   } TestCases[] = {
       {"BM_Malloc", &BM_AllocateAndDeallocate<MallocWrapper>},
       {"BM_New", &BM_AllocateAndDeallocate<NewWrapper>},
+#ifdef TEST_COMPILER_CLANG
       {"BM_BuiltinNewDelete", BM_AllocateAndDeallocate<BuiltinNewWrapper>},
       {"BM_BuiltinSizedNewDelete", BM_AllocateAndDeallocate<BuiltinSizedNewWrapper>},
       {"BM_BuiltinNewAllocateOnly", BM_AllocateOnly<BuiltinSizedNewWrapper>},
       {"BM_BuiltinNewSizedDeallocateOnly", BM_DeallocateOnly<BuiltinSizedNewWrapper>},
-
+#endif
   };
   for (auto TC : TestCases) {
     benchmark::RegisterBenchmark(TC.name, TC.func)->Range(16, 4096 * 2);

diff  --git a/libcxx/test/benchmarks/atomic_wait.bench.cpp b/libcxx/test/benchmarks/atomic_wait.bench.cpp
index dd541b445448ac..49503a318fda16 100644
--- a/libcxx/test/benchmarks/atomic_wait.bench.cpp
+++ b/libcxx/test/benchmarks/atomic_wait.bench.cpp
@@ -6,8 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <atomic>
 #include <numeric>
+#include <stop_token>
 #include <thread>
 
 #include "benchmark/benchmark.h"

diff  --git a/libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp b/libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
index 1a52e5dddb8e9c..b6f7f40b5cd34b 100644
--- a/libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
+++ b/libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 // To run this test, build libcxx and cxx-benchmarks targets
 // cd third-party/benchmark/tools
 // ./compare.py filters ../../../build/libcxx/benchmarks/atomic_wait_vs_mutex_lock.libcxx.out BM_atomic_wait BM_mutex
@@ -13,6 +15,7 @@
 #include <atomic>
 #include <mutex>
 #include <numeric>
+#include <stop_token>
 #include <thread>
 
 #include "benchmark/benchmark.h"

diff  --git a/libcxx/test/benchmarks/deque.bench.cpp b/libcxx/test/benchmarks/deque.bench.cpp
index d6dadaa3f23e4d..b8f3b76dd27ee6 100644
--- a/libcxx/test/benchmarks/deque.bench.cpp
+++ b/libcxx/test/benchmarks/deque.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <deque>
 
 #include "benchmark/benchmark.h"

diff  --git a/libcxx/test/benchmarks/deque_iterator.bench.cpp b/libcxx/test/benchmarks/deque_iterator.bench.cpp
index 0eb23f2f3bea55..d1db8ed358c0bd 100644
--- a/libcxx/test/benchmarks/deque_iterator.bench.cpp
+++ b/libcxx/test/benchmarks/deque_iterator.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <deque>
 

diff  --git a/libcxx/test/benchmarks/exception_ptr.bench.cpp b/libcxx/test/benchmarks/exception_ptr.bench.cpp
index 1292ad7935e375..7791c510b1eb66 100644
--- a/libcxx/test/benchmarks/exception_ptr.bench.cpp
+++ b/libcxx/test/benchmarks/exception_ptr.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03
+
 #include <benchmark/benchmark.h>
 #include <exception>
 

diff  --git a/libcxx/test/benchmarks/filesystem.bench.cpp b/libcxx/test/benchmarks/filesystem.bench.cpp
index 19f9586d085289..83a87c86d3de0a 100644
--- a/libcxx/test/benchmarks/filesystem.bench.cpp
+++ b/libcxx/test/benchmarks/filesystem.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <filesystem>
 
 #include "GenerateInput.h"

diff  --git a/libcxx/test/benchmarks/format.bench.cpp b/libcxx/test/benchmarks/format.bench.cpp
index 22f369f0d3be0a..267ef229506685 100644
--- a/libcxx/test/benchmarks/format.bench.cpp
+++ b/libcxx/test/benchmarks/format.bench.cpp
@@ -6,12 +6,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <format>
 
 #include <string>
 
 #include "benchmark/benchmark.h"
 #include "make_string.h"
+#include "test_macros.h"
 
 #define CSTR(S) MAKE_CSTRING(CharT, S)
 
@@ -28,6 +31,8 @@ static void BM_format_string(benchmark::State& state) {
   state.SetBytesProcessed(state.iterations() * size * sizeof(CharT));
 }
 BENCHMARK(BM_format_string<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_format_string<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#endif
 
 BENCHMARK_MAIN();

diff  --git a/libcxx/test/benchmarks/format/write_double_comparison.bench.cpp b/libcxx/test/benchmarks/format/write_double_comparison.bench.cpp
index 93db5f1f5f4560..9bd4c5c57942b8 100644
--- a/libcxx/test/benchmarks/format/write_double_comparison.bench.cpp
+++ b/libcxx/test/benchmarks/format/write_double_comparison.bench.cpp
@@ -6,6 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// Don't warn about std::sprintf
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
 #include <array>
 #include <charconv>
 #include <cstdio>
@@ -29,7 +34,7 @@ static void BM_sprintf(benchmark::State& state) {
   std::array<char, 100> output;
   while (state.KeepRunningBatch(data.size()))
     for (auto value : data) {
-      sprintf(output.data(), "%f", value);
+      std::sprintf(output.data(), "%f", value);
       benchmark::DoNotOptimize(output.data());
     }
 }

diff  --git a/libcxx/test/benchmarks/format/write_int_comparison.bench.cpp b/libcxx/test/benchmarks/format/write_int_comparison.bench.cpp
index 835a56f0362254..e71e545d81a9cc 100644
--- a/libcxx/test/benchmarks/format/write_int_comparison.bench.cpp
+++ b/libcxx/test/benchmarks/format/write_int_comparison.bench.cpp
@@ -6,6 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// Don't warn about std::sprintf
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
 #include <array>
 #include <charconv>
 #include <cstdio>
@@ -29,7 +34,7 @@ static void BM_sprintf(benchmark::State& state) {
   std::array<char, 100> output;
   while (state.KeepRunningBatch(data.size()))
     for (auto value : data) {
-      sprintf(output.data(), "%d", value);
+      std::sprintf(output.data(), "%d", value);
       benchmark::DoNotOptimize(output.data());
     }
 }

diff  --git a/libcxx/test/benchmarks/format/write_string_comparison.bench.cpp b/libcxx/test/benchmarks/format/write_string_comparison.bench.cpp
index bbd49f785d60d9..3e76b62275547d 100644
--- a/libcxx/test/benchmarks/format/write_string_comparison.bench.cpp
+++ b/libcxx/test/benchmarks/format/write_string_comparison.bench.cpp
@@ -6,6 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// Don't warn about std::sprintf
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
 #include <array>
 #include <concepts>
 #include <cstdio>
@@ -135,7 +140,7 @@ std::string_view string_view_6000_characters = c_string_6000_characters;
 static void BM_sprintf(benchmark::State& state, const char* value) {
   std::array<char, 10'000> output;
   for (auto _ : state)
-    benchmark::DoNotOptimize(sprintf(output.data(), "%s", value));
+    benchmark::DoNotOptimize(std::sprintf(output.data(), "%s", value));
 }
 
 template <class T>
@@ -191,18 +196,6 @@ static void BM_format_to_iterator(benchmark::State& state, const T& value, F&& f
                                                                                                                        \
   /* */
 
-// Verify these types have an iterator that format has optimizations for.
-LIBCPP_STATIC_ASSERT(std::same_as<std::array<char, 1>::iterator, char*> || // the type depends on an ABI flag
-                     std::same_as<std::array<char, 1>::iterator, std::__wrap_iter<char*>>);
-LIBCPP_STATIC_ASSERT(std::same_as<std::string::iterator, std::__wrap_iter<char*>>);
-LIBCPP_STATIC_ASSERT(std::same_as<std::vector<char>::iterator, std::__wrap_iter<char*>>);
-
-// Verify these types have an iterator that format does not optimize for
-LIBCPP_STATIC_ASSERT(!std::same_as<std::deque<char>::iterator, char*> &&
-                     !std::same_as<std::deque<char>::iterator, std::__wrap_iter<char*>>);
-LIBCPP_STATIC_ASSERT(!std::same_as<std::list<char>::iterator, char*> &&
-                     !std::same_as<std::list<char>::iterator, std::__wrap_iter<char*>>);
-
 BENCHMARK_CAPTURE(BM_sprintf, C_string_len_6, c_string_6_characters);
 FORMAT_BENCHMARKS(C_string_len_6, c_string_6_characters)
 FORMAT_BENCHMARKS(string_len_6, string_6_characters)

diff  --git a/libcxx/test/benchmarks/format_to.bench.cpp b/libcxx/test/benchmarks/format_to.bench.cpp
index e8fc6c8b372fe0..5b06e826715e7a 100644
--- a/libcxx/test/benchmarks/format_to.bench.cpp
+++ b/libcxx/test/benchmarks/format_to.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <format>
 
 #include <algorithm>
@@ -18,6 +20,7 @@
 
 #include "benchmark/benchmark.h"
 #include "make_string.h"
+#include "test_macros.h"
 
 #define CSTR(S) MAKE_CSTRING(CharT, S)
 
@@ -90,6 +93,7 @@ BENCHMARK(BM_format_to_string_begin<std::list<char>>)->RangeMultiplier(2)->Range
 BENCHMARK(BM_format_to_string_span<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_string_pointer<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
 
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_format_to_string_back_inserter<std::wstring>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_string_back_inserter<std::vector<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_string_back_inserter<std::list<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
@@ -98,5 +102,6 @@ BENCHMARK(BM_format_to_string_begin<std::vector<wchar_t>>)->RangeMultiplier(2)->
 BENCHMARK(BM_format_to_string_begin<std::list<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_string_span<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_string_pointer<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#endif
 
 BENCHMARK_MAIN();

diff  --git a/libcxx/test/benchmarks/format_to_n.bench.cpp b/libcxx/test/benchmarks/format_to_n.bench.cpp
index 96386ff93df996..30f6ce74f7c932 100644
--- a/libcxx/test/benchmarks/format_to_n.bench.cpp
+++ b/libcxx/test/benchmarks/format_to_n.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <format>
 
 #include <algorithm>
@@ -18,6 +20,7 @@
 
 #include "benchmark/benchmark.h"
 #include "make_string.h"
+#include "test_macros.h"
 
 #define CSTR(S) MAKE_CSTRING(CharT, S)
 
@@ -90,6 +93,7 @@ BENCHMARK(BM_format_to_n_string_begin<std::list<char>>)->RangeMultiplier(2)->Ran
 BENCHMARK(BM_format_to_n_string_span<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_n_string_pointer<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
 
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_format_to_n_string_back_inserter<std::wstring>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_n_string_back_inserter<std::vector<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_n_string_back_inserter<std::list<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
@@ -98,5 +102,6 @@ BENCHMARK(BM_format_to_n_string_begin<std::vector<wchar_t>>)->RangeMultiplier(2)
 BENCHMARK(BM_format_to_n_string_begin<std::list<wchar_t>>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_n_string_span<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
 BENCHMARK(BM_format_to_n_string_pointer<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#endif
 
 BENCHMARK_MAIN();

diff  --git a/libcxx/test/benchmarks/formatted_size.bench.cpp b/libcxx/test/benchmarks/formatted_size.bench.cpp
index 9af23437fea213..e244f0bbb8cb2e 100644
--- a/libcxx/test/benchmarks/formatted_size.bench.cpp
+++ b/libcxx/test/benchmarks/formatted_size.bench.cpp
@@ -6,12 +6,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <format>
 
 #include <string>
 
 #include "benchmark/benchmark.h"
 #include "make_string.h"
+#include "test_macros.h"
 
 #define CSTR(S) MAKE_CSTRING(CharT, S)
 
@@ -26,6 +29,8 @@ static void BM_formatted_size_string(benchmark::State& state) {
   state.SetBytesProcessed(state.iterations() * size * sizeof(CharT));
 }
 BENCHMARK(BM_formatted_size_string<char>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_formatted_size_string<wchar_t>)->RangeMultiplier(2)->Range(1, 1 << 20);
+#endif
 
 BENCHMARK_MAIN();

diff  --git a/libcxx/test/benchmarks/formatter_float.bench.cpp b/libcxx/test/benchmarks/formatter_float.bench.cpp
index d1da58598ea462..ec20eab3c09371 100644
--- a/libcxx/test/benchmarks/formatter_float.bench.cpp
+++ b/libcxx/test/benchmarks/formatter_float.bench.cpp
@@ -6,9 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <format>
 
 #include <array>
+#include <bit>
+#include <cmath>
 #include <limits>
 #include <random>
 #include <string>
@@ -90,9 +94,9 @@ struct Value<ValueE::Random> {
     std::array<F, 1000> result;
     std::generate(result.begin(), result.end(), [&] {
       while (true) {
-        auto result = std::bit_cast<F>(distribution(generator));
-        if (std::isfinite(result))
-          return result;
+        auto val = std::bit_cast<F>(distribution(generator));
+        if (std::isfinite(val))
+          return val;
       }
     });
     return result;

diff  --git a/libcxx/test/benchmarks/formatter_int.bench.cpp b/libcxx/test/benchmarks/formatter_int.bench.cpp
index a02b3ac0522305..68f0f18bde4d20 100644
--- a/libcxx/test/benchmarks/formatter_int.bench.cpp
+++ b/libcxx/test/benchmarks/formatter_int.bench.cpp
@@ -6,12 +6,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <array>
 #include <format>
 #include <random>
 
 #include "CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
+#include "test_macros.h"
 
 // Tests the full range of the value.
 template <class T>
@@ -49,11 +52,13 @@ static void BM_BasicLow(benchmark::State& state) {
     for (auto value : data)
       benchmark::DoNotOptimize(std::format_to(output.begin(), "{}", value));
 }
+#ifndef TEST_HAS_NO_INT128
 BENCHMARK(BM_BasicLow<__uint128_t>);
 BENCHMARK(BM_BasicLow<__int128_t>);
 
 BENCHMARK(BM_Basic<__uint128_t>);
 BENCHMARK(BM_Basic<__int128_t>);
+#endif
 
 // *** Localization ***
 enum class LocalizationE { False, True };

diff  --git a/libcxx/test/benchmarks/function.bench.cpp b/libcxx/test/benchmarks/function.bench.cpp
index dd397bcfa5b074..e607162d23b72f 100644
--- a/libcxx/test/benchmarks/function.bench.cpp
+++ b/libcxx/test/benchmarks/function.bench.cpp
@@ -6,10 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <cstdint>
 #include <functional>
 #include <memory>
 #include <string>
+#include <utility>
 
 #include "CartesianBenchmarks.h"
 #include "benchmark/benchmark.h"
@@ -101,6 +104,7 @@ inline Function MakeFunction(FunctionType type, bool opaque = false) {
   case FunctionType::LargeNonTrivialFunctor:
     return maybeOpaque(LargeNonTrivialFunctor{}, opaque);
   }
+  std::unreachable();
 }
 
 template <class Opacity, class FunctionType>
@@ -179,7 +183,7 @@ template <class FunctionType>
 struct Invoke {
   static void run(benchmark::State& state) {
     S s;
-    const auto value = MakeFunction(FunctionType());
+    auto value = MakeFunction(FunctionType());
     for (auto _ : state) {
       benchmark::DoNotOptimize(value);
       benchmark::DoNotOptimize(value(&s));

diff  --git a/libcxx/test/benchmarks/hash.bench.cpp b/libcxx/test/benchmarks/hash.bench.cpp
index e0159874476293..1e1a0f36ec116c 100644
--- a/libcxx/test/benchmarks/hash.bench.cpp
+++ b/libcxx/test/benchmarks/hash.bench.cpp
@@ -19,38 +19,6 @@
 
 constexpr std::size_t TestNumInputs = 1024;
 
-template <class _Size>
-inline TEST_ALWAYS_INLINE _Size loadword(const void* __p) {
-  _Size __r;
-  std::memcpy(&__r, __p, sizeof(__r));
-  return __r;
-}
-
-inline TEST_ALWAYS_INLINE std::size_t hash_len_16(std::size_t __u, std::size_t __v) {
-  const std::size_t __mul = 0x9ddfea08eb382d69ULL;
-  std::size_t __a         = (__u ^ __v) * __mul;
-  __a ^= (__a >> 47);
-  std::size_t __b = (__v ^ __a) * __mul;
-  __b ^= (__b >> 47);
-  __b *= __mul;
-  return __b;
-}
-
-template <std::size_t _Len>
-inline TEST_ALWAYS_INLINE std::size_t hash_len_0_to_8(const char* __s) {
-  static_assert(_Len == 4 || _Len == 8, "");
-  const uint64_t __a = loadword<uint32_t>(__s);
-  const uint64_t __b = loadword<uint32_t>(__s + _Len - 4);
-  return hash_len_16(_Len + (__a << 3), __b);
-}
-
-struct UInt32Hash {
-  UInt32Hash() = default;
-  inline TEST_ALWAYS_INLINE std::size_t operator()(uint32_t data) const {
-    return hash_len_0_to_8<4>(reinterpret_cast<const char*>(&data));
-  }
-};
-
 template <class HashFn, class GenInputs>
 void BM_Hash(benchmark::State& st, HashFn fn, GenInputs gen) {
   auto in               = gen(st.range(0));
@@ -68,13 +36,7 @@ void BM_Hash(benchmark::State& st, HashFn fn, GenInputs gen) {
 BENCHMARK_CAPTURE(BM_Hash, uint32_random_std_hash, std::hash<uint32_t>{}, getRandomIntegerInputs<uint32_t>)
     ->Arg(TestNumInputs);
 
-BENCHMARK_CAPTURE(BM_Hash, uint32_random_custom_hash, UInt32Hash{}, getRandomIntegerInputs<uint32_t>)
-    ->Arg(TestNumInputs);
-
 BENCHMARK_CAPTURE(BM_Hash, uint32_top_std_hash, std::hash<uint32_t>{}, getSortedTopBitsIntegerInputs<uint32_t>)
     ->Arg(TestNumInputs);
 
-BENCHMARK_CAPTURE(BM_Hash, uint32_top_custom_hash, UInt32Hash{}, getSortedTopBitsIntegerInputs<uint32_t>)
-    ->Arg(TestNumInputs);
-
 BENCHMARK_MAIN();

diff  --git a/libcxx/test/benchmarks/join_view.bench.cpp b/libcxx/test/benchmarks/join_view.bench.cpp
index c789a39a8e2080..9f6db4a3766afc 100644
--- a/libcxx/test/benchmarks/join_view.bench.cpp
+++ b/libcxx/test/benchmarks/join_view.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 #include <deque>
 #include <ranges>

diff  --git a/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp b/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
index 072935ce3c7635..a0b33d26801dca 100644
--- a/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
+++ b/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <algorithm>
 
 #include "benchmark/benchmark.h"

diff  --git a/libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp b/libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
index 439eea81d9a19c..43fe31823104ad 100644
--- a/libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
+++ b/libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03
+
 #include <cstddef>
 
 #include "benchmark/benchmark.h"

diff  --git a/libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp b/libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
index df4daf7409b8f7..e79d865c2ca30d 100644
--- a/libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
+++ b/libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11
+
 #include <cassert>
 #include <cstddef>
 #include <utility>

diff  --git a/libcxx/test/benchmarks/map.bench.cpp b/libcxx/test/benchmarks/map.bench.cpp
index 255164b22aa807..81bdc5077f026f 100644
--- a/libcxx/test/benchmarks/map.bench.cpp
+++ b/libcxx/test/benchmarks/map.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <cstdint>
 #include <map>

diff  --git a/libcxx/test/benchmarks/monotonic_buffer.bench.cpp b/libcxx/test/benchmarks/monotonic_buffer.bench.cpp
index 39bb853ccba5dd..66ab5809985b5b 100644
--- a/libcxx/test/benchmarks/monotonic_buffer.bench.cpp
+++ b/libcxx/test/benchmarks/monotonic_buffer.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <list>
 #include <memory_resource>
 

diff  --git a/libcxx/test/benchmarks/numeric/gcd.bench.cpp b/libcxx/test/benchmarks/numeric/gcd.bench.cpp
index f8b6a856cd0d58..abbc7e9dd04f96 100644
--- a/libcxx/test/benchmarks/numeric/gcd.bench.cpp
+++ b/libcxx/test/benchmarks/numeric/gcd.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <array>
 #include <benchmark/benchmark.h>
 #include <cstring>
@@ -41,7 +43,8 @@ static void bm_gcd_trivial(benchmark::State& state) {
 BENCHMARK(bm_gcd_trivial);
 
 static void bm_gcd_complex(benchmark::State& state) {
-  int lhs = 2971215073, rhs = 1836311903;
+  long long lhs = 2971215073;
+  long long rhs = 1836311903;
   for (auto _ : state) {
     benchmark::DoNotOptimize(lhs);
     benchmark::DoNotOptimize(rhs);

diff  --git a/libcxx/test/benchmarks/ordered_set.bench.cpp b/libcxx/test/benchmarks/ordered_set.bench.cpp
index 22540d8ab7e0c2..7883233c23aeee 100644
--- a/libcxx/test/benchmarks/ordered_set.bench.cpp
+++ b/libcxx/test/benchmarks/ordered_set.bench.cpp
@@ -6,9 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <algorithm>
 #include <cstdint>
 #include <memory>
+#include <numeric>
 #include <random>
 #include <set>
 #include <string>
@@ -181,7 +184,7 @@ struct IterateRangeFor : Base {
     while (State.KeepRunningBatch(TableSize * NumTables)) {
       for (auto& Set : Data.Sets) {
         for (auto& V : Set) {
-          benchmark::DoNotOptimize(V);
+          benchmark::DoNotOptimize(const_cast<std::set<uint64_t>::reference>(V));
         }
       }
     }
@@ -199,7 +202,7 @@ struct IterateBeginEnd : Base {
     while (State.KeepRunningBatch(TableSize * NumTables)) {
       for (auto& Set : Data.Sets) {
         for (auto it = Set.begin(); it != Set.end(); ++it) {
-          benchmark::DoNotOptimize(*it);
+          benchmark::DoNotOptimize(const_cast<std::set<uint64_t>::reference>(*it));
         }
       }
     }

diff  --git a/libcxx/test/benchmarks/random.bench.cpp b/libcxx/test/benchmarks/random.bench.cpp
index 0645a4e8766064..e6af4c3e26eaf8 100644
--- a/libcxx/test/benchmarks/random.bench.cpp
+++ b/libcxx/test/benchmarks/random.bench.cpp
@@ -6,9 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03
+
 #include <algorithm>
 #include <array>
 #include <cstddef>
+#include <cstdint>
 #include <functional>
 #include <random>
 

diff  --git a/libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp b/libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
index 548293507ac03e..84a49a8d07d04e 100644
--- a/libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
+++ b/libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 // This benchmark compares the performance of std::mutex and std::shared_mutex in contended scenarios.
 // it's meant to establish a baseline overhead for std::shared_mutex and std::mutex, and to help inform decisions about
 // which mutex to use when selecting a mutex type for a given use case.

diff  --git a/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
index e0e29cf285d0c1..775f3edb24ad54 100644
--- a/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
+++ b/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
@@ -4,14 +4,17 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #ifndef _LIBCPP_HAS_NO_UNICODE
 
+#  include <concepts>
 #  include <format>
 #  include <string_view>
 
 #  include "benchmark/benchmark.h"
-
 #  include "make_string.h"
+#  include "test_macros.h"
 
 #  define SV(S) MAKE_STRING_VIEW(CharT, S)
 
@@ -282,11 +285,13 @@ BENCHMARK(BM_cyrillic_text<char>);
 BENCHMARK(BM_japanese_text<char>);
 BENCHMARK(BM_emoji_text<char>);
 
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_ascii_text<wchar_t>);
 BENCHMARK(BM_unicode_text<wchar_t>);
 BENCHMARK(BM_cyrillic_text<wchar_t>);
 BENCHMARK(BM_japanese_text<wchar_t>);
 BENCHMARK(BM_emoji_text<wchar_t>);
+#  endif
 
 BENCHMARK_MAIN();
 

diff  --git a/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
index c030ab652482f3..0b0cd64c7e4b8f 100644
--- a/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
+++ b/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
@@ -6,18 +6,21 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 // This test formats a larger piece of text in "escaped" mode. It uses several
 // datasets to give an impression how the amount of multibyte UTF-8 sequences
 // and larger grapheme clusters affect the performance.
 
 #ifndef _LIBCPP_HAS_NO_UNICODE
 
+#  include <concepts>
 #  include <format>
 #  include <string_view>
 
 #  include "benchmark/benchmark.h"
-
 #  include "make_string.h"
+#  include "test_macros.h"
 
 #  define SV(S) MAKE_STRING_VIEW(CharT, S)
 
@@ -285,11 +288,13 @@ BENCHMARK(BM_cyrillic_escaped<char>);
 BENCHMARK(BM_japanese_escaped<char>);
 BENCHMARK(BM_emoji_escaped<char>);
 
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
 BENCHMARK(BM_ascii_escaped<wchar_t>);
 BENCHMARK(BM_unicode_escaped<wchar_t>);
 BENCHMARK(BM_cyrillic_escaped<wchar_t>);
 BENCHMARK(BM_japanese_escaped<wchar_t>);
 BENCHMARK(BM_emoji_escaped<wchar_t>);
+#  endif
 
 BENCHMARK_MAIN();
 

diff  --git a/libcxx/test/benchmarks/stop_token.bench.cpp b/libcxx/test/benchmarks/stop_token.bench.cpp
index 6be4736c3aec7b..6149f91c6fc384 100644
--- a/libcxx/test/benchmarks/stop_token.bench.cpp
+++ b/libcxx/test/benchmarks/stop_token.bench.cpp
@@ -6,7 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
 #include <numeric>
+#include <optional>
 #include <stop_token>
 #include <thread>
 

diff  --git a/libcxx/test/benchmarks/string.bench.cpp b/libcxx/test/benchmarks/string.bench.cpp
index 49d37229fa35b5..0d7ce2b87bead6 100644
--- a/libcxx/test/benchmarks/string.bench.cpp
+++ b/libcxx/test/benchmarks/string.bench.cpp
@@ -6,7 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <cstdint>
+#include <cstdlib>
 #include <new>
 #include <vector>
 
@@ -92,6 +95,7 @@ TEST_ALWAYS_INLINE const char* getSmallString(DiffType D) {
   case DiffType::ChangeLast:
     return "01234567-";
   }
+  __builtin_unreachable();
 }
 
 static constexpr char LargeStringLiteral[] = "012345678901234567890123456789012345678901234567890123456789012";
@@ -109,6 +113,7 @@ TEST_ALWAYS_INLINE const char* getLargeString(DiffType D) {
   case DiffType::ChangeLast:
     return "0" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "-";
   }
+  __builtin_unreachable();
 }
 
 TEST_ALWAYS_INLINE const char* getHugeString(DiffType D) {
@@ -127,6 +132,7 @@ TEST_ALWAYS_INLINE const char* getHugeString(DiffType D) {
   case DiffType::ChangeLast:
     return "0123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "012345678-";
   }
+  __builtin_unreachable();
 }
 
 TEST_ALWAYS_INLINE const char* getString(Length L, DiffType D = DiffType::Control) {
@@ -140,6 +146,7 @@ TEST_ALWAYS_INLINE const char* getString(Length L, DiffType D = DiffType::Contro
   case Length::Huge:
     return getHugeString(D);
   }
+  __builtin_unreachable();
 }
 
 TEST_ALWAYS_INLINE std::string makeString(Length L, DiffType D = DiffType::Control, Opacity O = Opacity::Transparent) {
@@ -153,6 +160,7 @@ TEST_ALWAYS_INLINE std::string makeString(Length L, DiffType D = DiffType::Contr
   case Length::Huge:
     return maybeOpaque(getHugeString(D), O == Opacity::Opaque);
   }
+  __builtin_unreachable();
 }
 
 template <class Length, class Opaque>
@@ -170,13 +178,13 @@ template <class Length, bool MeasureCopy, bool MeasureDestroy>
 static void StringCopyAndDestroy(benchmark::State& state) {
   static constexpr size_t NumStrings = 1024;
   auto Orig                          = makeString(Length());
-  std::aligned_storage<sizeof(std::string)>::type Storage[NumStrings];
+  alignas(std::string) char Storage[NumStrings * sizeof(std::string)];
 
   while (state.KeepRunningBatch(NumStrings)) {
     if (!MeasureCopy)
       state.PauseTiming();
     for (size_t I = 0; I < NumStrings; ++I) {
-      ::new (static_cast<void*>(Storage + I)) std::string(Orig);
+      ::new (reinterpret_cast<std::string*>(Storage) + I) std::string(Orig);
     }
     if (!MeasureCopy)
       state.ResumeTiming();
@@ -184,7 +192,7 @@ static void StringCopyAndDestroy(benchmark::State& state) {
       state.PauseTiming();
     for (size_t I = 0; I < NumStrings; ++I) {
       using S = std::string;
-      reinterpret_cast<S*>(Storage + I)->~S();
+      (reinterpret_cast<S*>(Storage) + I)->~S();
     }
     if (!MeasureDestroy)
       state.ResumeTiming();
@@ -209,16 +217,16 @@ template <class Length>
 struct StringMove {
   static void run(benchmark::State& state) {
     // Keep two object locations and move construct back and forth.
-    std::aligned_storage<sizeof(std::string), alignof(std::string)>::type Storage[2];
+    alignas(std::string) char Storage[2 * sizeof(std::string)];
     using S  = std::string;
     size_t I = 0;
-    S* newS  = new (static_cast<void*>(Storage)) std::string(makeString(Length()));
+    S* newS  = new (reinterpret_cast<std::string*>(Storage)) std::string(makeString(Length()));
     for (auto _ : state) {
       // Switch locations.
       I ^= 1;
       benchmark::DoNotOptimize(Storage);
       // Move construct into the new location,
-      S* tmpS = new (static_cast<void*>(Storage + I)) S(std::move(*newS));
+      S* tmpS = new (reinterpret_cast<std::string*>(Storage) + I) S(std::move(*newS));
       // then destroy the old one.
       newS->~S();
       newS = tmpS;
@@ -481,14 +489,14 @@ struct StringRead {
     for (auto _ : state) {
       // Jump long enough to defeat cache locality, and use a value that is
       // coprime with NumStrings to ensure we visit every element.
-      I             = (I + 17) % NumStrings;
-      const auto& V = Values[I];
+      I       = (I + 17) % NumStrings;
+      auto& V = Values[I];
 
       // Read everything first. Escaping data() through DoNotOptimize might
       // cause the compiler to have to recalculate information about `V` due to
       // aliasing.
-      const char* const Data = V.data();
-      const size_t Size      = V.size();
+      char* Data  = V.data();
+      size_t Size = V.size();
       benchmark::DoNotOptimize(Data);
       benchmark::DoNotOptimize(Size);
       if (Depth() == ::Depth::Deep) {

diff  --git a/libcxx/test/benchmarks/stringstream.bench.cpp b/libcxx/test/benchmarks/stringstream.bench.cpp
index a333900d6d2fa8..b7c50a96ef51e3 100644
--- a/libcxx/test/benchmarks/stringstream.bench.cpp
+++ b/libcxx/test/benchmarks/stringstream.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include "benchmark/benchmark.h"
 #include "test_macros.h"
 

diff  --git a/libcxx/test/benchmarks/system_error.bench.cpp b/libcxx/test/benchmarks/system_error.bench.cpp
index 4b0568d503bc5a..8506efef132634 100644
--- a/libcxx/test/benchmarks/system_error.bench.cpp
+++ b/libcxx/test/benchmarks/system_error.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03
+
 #include <string>
 #include <system_error>
 

diff  --git a/libcxx/test/benchmarks/to_chars.bench.cpp b/libcxx/test/benchmarks/to_chars.bench.cpp
index f79dfda28e1658..cee969cd06e1b9 100644
--- a/libcxx/test/benchmarks/to_chars.bench.cpp
+++ b/libcxx/test/benchmarks/to_chars.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include <array>
 #include <charconv>
 #include <random>

diff  --git a/libcxx/test/benchmarks/unordered_set_operations.bench.cpp b/libcxx/test/benchmarks/unordered_set_operations.bench.cpp
index 2e42d6d345b998..7b1700bfd850d1 100644
--- a/libcxx/test/benchmarks/unordered_set_operations.bench.cpp
+++ b/libcxx/test/benchmarks/unordered_set_operations.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <cstdint>
 #include <cstdlib>
 #include <cstring>
@@ -23,77 +25,9 @@ using namespace ContainerBenchmarks;
 
 constexpr std::size_t TestNumInputs = 1024;
 
-template <class _Size>
-inline TEST_ALWAYS_INLINE _Size loadword(const void* __p) {
-  _Size __r;
-  std::memcpy(&__r, __p, sizeof(__r));
-  return __r;
-}
-
-inline TEST_ALWAYS_INLINE std::size_t rotate_by_at_least_1(std::size_t __val, int __shift) {
-  return (__val >> __shift) | (__val << (64 - __shift));
-}
-
-inline TEST_ALWAYS_INLINE std::size_t hash_len_16(std::size_t __u, std::size_t __v) {
-  const std::size_t __mul = 0x9ddfea08eb382d69ULL;
-  std::size_t __a         = (__u ^ __v) * __mul;
-  __a ^= (__a >> 47);
-  std::size_t __b = (__v ^ __a) * __mul;
-  __b ^= (__b >> 47);
-  __b *= __mul;
-  return __b;
-}
-
-template <std::size_t _Len>
-inline TEST_ALWAYS_INLINE std::size_t hash_len_0_to_8(const char* __s) {
-  static_assert(_Len == 4 || _Len == 8, "");
-  const uint64_t __a = loadword<uint32_t>(__s);
-  const uint64_t __b = loadword<uint32_t>(__s + _Len - 4);
-  return hash_len_16(_Len + (__a << 3), __b);
-}
-
-struct UInt32Hash {
-  UInt32Hash() = default;
-  inline TEST_ALWAYS_INLINE std::size_t operator()(uint32_t data) const {
-    return hash_len_0_to_8<4>(reinterpret_cast<const char*>(&data));
-  }
-};
-
-struct UInt64Hash {
-  UInt64Hash() = default;
-  inline TEST_ALWAYS_INLINE std::size_t operator()(uint64_t data) const {
-    return hash_len_0_to_8<8>(reinterpret_cast<const char*>(&data));
-  }
-};
-
-struct UInt128Hash {
-  UInt128Hash() = default;
-  inline TEST_ALWAYS_INLINE std::size_t operator()(__uint128_t data) const {
-    const __uint128_t __mask = static_cast<std::size_t>(-1);
-    const std::size_t __a    = (std::size_t)(data & __mask);
-    const std::size_t __b    = (std::size_t)((data & (__mask << 64)) >> 64);
-    return hash_len_16(__a, rotate_by_at_least_1(__b + 16, 16)) ^ __b;
-  }
-};
-
-struct UInt32Hash2 {
-  UInt32Hash2() = default;
-  inline TEST_ALWAYS_INLINE std::size_t operator()(uint32_t data) const {
-    const uint32_t __m = 0x5bd1e995;
-    const uint32_t __r = 24;
-    uint32_t __h       = 4;
-    uint32_t __k       = data;
-    __k *= __m;
-    __k ^= __k >> __r;
-    __k *= __m;
-    __h *= __m;
-    __h ^= __k;
-    __h ^= __h >> 13;
-    __h *= __m;
-    __h ^= __h >> 15;
-    return __h;
-  }
-};
+// The purpose of this hash function is to NOT be implemented as the identity function,
+// which is how std::hash is implemented for smaller integral types.
+struct NonIdentityScalarHash : std::hash<unsigned long long> {};
 
 // The sole purpose of this comparator is to be used in BM_Rehash, where
 // we need something slow enough to be easily noticable in benchmark results.
@@ -138,7 +72,7 @@ BENCHMARK_CAPTURE(BM_InsertValue,
 
 BENCHMARK_CAPTURE(BM_InsertValueRehash,
                   unordered_set_top_bits_uint32,
-                  std::unordered_set<uint32_t, UInt32Hash>{},
+                  std::unordered_set<uint32_t, NonIdentityScalarHash>{},
                   getSortedTopBitsIntegerInputs<uint32_t>)
     ->Arg(TestNumInputs);
 
@@ -171,7 +105,7 @@ BENCHMARK_CAPTURE(
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_random_uint64,
-                  std::unordered_set<uint64_t, UInt64Hash>{},
+                  std::unordered_set<uint64_t, NonIdentityScalarHash>{},
                   getRandomIntegerInputs<uint64_t>)
     ->Arg(TestNumInputs);
 
@@ -182,22 +116,24 @@ BENCHMARK_CAPTURE(
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_sorted_uint64,
-                  std::unordered_set<uint64_t, UInt64Hash>{},
+                  std::unordered_set<uint64_t, NonIdentityScalarHash>{},
                   getSortedIntegerInputs<uint64_t>)
     ->Arg(TestNumInputs);
 
 // Sorted //
+#ifndef TEST_HAS_NO_INT128
 BENCHMARK_CAPTURE(BM_Find,
                   unordered_set_sorted_uint128,
-                  std::unordered_set<__uint128_t, UInt128Hash>{},
+                  std::unordered_set<__uint128_t>{},
                   getSortedTopBitsIntegerInputs<__uint128_t>)
     ->Arg(TestNumInputs);
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_sorted_uint128,
-                  std::unordered_set<__uint128_t, UInt128Hash>{},
+                  std::unordered_set<__uint128_t>{},
                   getSortedTopBitsIntegerInputs<__uint128_t>)
     ->Arg(TestNumInputs);
+#endif
 
 // Sorted //
 BENCHMARK_CAPTURE(
@@ -206,7 +142,7 @@ BENCHMARK_CAPTURE(
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_sorted_uint32,
-                  std::unordered_set<uint32_t, UInt32Hash2>{},
+                  std::unordered_set<uint32_t, NonIdentityScalarHash>{},
                   getSortedIntegerInputs<uint32_t>)
     ->Arg(TestNumInputs);
 
@@ -217,7 +153,7 @@ BENCHMARK_CAPTURE(
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_sorted_large_uint64,
-                  std::unordered_set<uint64_t, UInt64Hash>{},
+                  std::unordered_set<uint64_t, NonIdentityScalarHash>{},
                   getSortedLargeIntegerInputs<uint64_t>)
     ->Arg(TestNumInputs);
 
@@ -228,7 +164,7 @@ BENCHMARK_CAPTURE(
 
 BENCHMARK_CAPTURE(BM_FindRehash,
                   unordered_set_top_bits_uint64,
-                  std::unordered_set<uint64_t, UInt64Hash>{},
+                  std::unordered_set<uint64_t, NonIdentityScalarHash>{},
                   getSortedTopBitsIntegerInputs<uint64_t>)
     ->Arg(TestNumInputs);
 

diff  --git a/libcxx/test/benchmarks/variant_visit_1.bench.cpp b/libcxx/test/benchmarks/variant_visit_1.bench.cpp
index 3e6f22edc4da30..42b22aabaee04b 100644
--- a/libcxx/test/benchmarks/variant_visit_1.bench.cpp
+++ b/libcxx/test/benchmarks/variant_visit_1.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include "benchmark/benchmark.h"
 
 #include "VariantBenchmarks.h"

diff  --git a/libcxx/test/benchmarks/variant_visit_2.bench.cpp b/libcxx/test/benchmarks/variant_visit_2.bench.cpp
index 43aba4836160f6..328048cabc443e 100644
--- a/libcxx/test/benchmarks/variant_visit_2.bench.cpp
+++ b/libcxx/test/benchmarks/variant_visit_2.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include "benchmark/benchmark.h"
 
 #include "VariantBenchmarks.h"

diff  --git a/libcxx/test/benchmarks/variant_visit_3.bench.cpp b/libcxx/test/benchmarks/variant_visit_3.bench.cpp
index 85699421b0efd0..40f8c1b5fa2629 100644
--- a/libcxx/test/benchmarks/variant_visit_3.bench.cpp
+++ b/libcxx/test/benchmarks/variant_visit_3.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14
+
 #include "benchmark/benchmark.h"
 
 #include "VariantBenchmarks.h"

diff  --git a/libcxx/test/benchmarks/vector_operations.bench.cpp b/libcxx/test/benchmarks/vector_operations.bench.cpp
index 8698e45c006718..b0dffe35ec6e14 100644
--- a/libcxx/test/benchmarks/vector_operations.bench.cpp
+++ b/libcxx/test/benchmarks/vector_operations.bench.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
 #include <cstdint>
 #include <cstdlib>
 #include <cstring>


        


More information about the libcxx-commits mailing list