From 0df580e5d7786c4ffebc4ea380d7d0b1d26650d4 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Thu, 5 Mar 2026 08:10:42 +0200 Subject: [PATCH 1/7] Vector algorithms: trim runtime coverage for ARM64EC non-vectorized fallbacks --- tests/std/tests/VSO_0000000_vector_algorithms/test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index 3a77c979cf9..553e1b1432a 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1213,6 +1213,7 @@ void test_swap_arrays(mt19937_64& gen) { } void test_vector_algorithms(mt19937_64& gen) { +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_adjacent_difference(gen); test_adjacent_difference(gen); test_adjacent_difference(gen); @@ -1309,11 +1310,13 @@ void test_vector_algorithms(mt19937_64& gen) { test_min_max_element(gen); test_min_max_element(gen); test_min_max_element(gen); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_min_max_element(gen); test_min_max_element(gen); test_min_max_element_pointers(gen); +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_min_max_element_special_cases(); // SSE2 vectors test_min_max_element_special_cases(); // AVX2 vectors test_min_max_element_special_cases(); // AVX512 vectors @@ -1347,6 +1350,7 @@ void test_vector_algorithms(mt19937_64& gen) { test_includes(gen); test_includes(gen); #endif // _HAS_CXX17 +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_replace(gen); test_replace(gen); @@ -1358,6 +1362,7 @@ void test_vector_algorithms(mt19937_64& gen) { test_replace(gen); test_replace(gen); +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_reverse(gen); test_reverse(gen); test_reverse(gen); @@ -1396,6 +1401,7 @@ void test_vector_algorithms(mt19937_64& gen) { test_rotate(gen); test_rotate(gen); test_rotate(gen); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_remove(gen); test_remove(gen); @@ -1419,6 +1425,7 @@ void test_vector_algorithms(mt19937_64& gen) { test_unique(gen); +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_swap_ranges(gen); test_swap_ranges(gen); test_swap_ranges(gen); @@ -1439,6 +1446,7 @@ void test_vector_algorithms(mt19937_64& gen) { test_swap_arrays(gen); test_swap_arrays(gen); test_swap_arrays(gen); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ } template @@ -1874,6 +1882,7 @@ void test_gh_5757_find_first_of() { } void test_string(mt19937_64& gen) { +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_basic_string(gen); test_basic_string(gen); #ifdef __cpp_lib_char8_t @@ -1884,6 +1893,7 @@ void test_string(mt19937_64& gen) { test_basic_string(gen); test_gh_5757_find_first_of(); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ } void test_various_containers() { From eac032307e5361e8644c0a90cb3ff27ffd72c1cf Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Thu, 5 Mar 2026 09:15:34 +0200 Subject: [PATCH 2/7] fix compiler warning --- tests/std/tests/VSO_0000000_vector_algorithms/test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index 553e1b1432a..e72e469f857 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1882,7 +1882,6 @@ void test_gh_5757_find_first_of() { } void test_string(mt19937_64& gen) { -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_basic_string(gen); test_basic_string(gen); #ifdef __cpp_lib_char8_t @@ -1893,7 +1892,6 @@ void test_string(mt19937_64& gen) { test_basic_string(gen); test_gh_5757_find_first_of(); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ } void test_various_containers() { @@ -1968,6 +1966,8 @@ int main() { test_vector_algorithms(gen); test_various_containers(); test_bitset(gen); +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_string(gen); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ }); } From bdb3bdf2c1a1f6c2a5d95445919a7f3e450ade1a Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 6 Mar 2026 20:30:34 +0200 Subject: [PATCH 3/7] Remove falback path from main vector algoirthms test function --- tests/std/tests/VSO_0000000_vector_algorithms/test.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index e72e469f857..bfa99c11457 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1213,7 +1213,6 @@ void test_swap_arrays(mt19937_64& gen) { } void test_vector_algorithms(mt19937_64& gen) { -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_adjacent_difference(gen); test_adjacent_difference(gen); test_adjacent_difference(gen); @@ -1310,13 +1309,11 @@ void test_vector_algorithms(mt19937_64& gen) { test_min_max_element(gen); test_min_max_element(gen); test_min_max_element(gen); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_min_max_element(gen); test_min_max_element(gen); test_min_max_element_pointers(gen); -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_min_max_element_special_cases(); // SSE2 vectors test_min_max_element_special_cases(); // AVX2 vectors test_min_max_element_special_cases(); // AVX512 vectors @@ -1350,7 +1347,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_includes(gen); test_includes(gen); #endif // _HAS_CXX17 -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_replace(gen); test_replace(gen); @@ -1362,7 +1358,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_replace(gen); test_replace(gen); -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_reverse(gen); test_reverse(gen); test_reverse(gen); @@ -1401,7 +1396,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_rotate(gen); test_rotate(gen); test_rotate(gen); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_remove(gen); test_remove(gen); @@ -1425,7 +1419,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_unique(gen); -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_swap_ranges(gen); test_swap_ranges(gen); test_swap_ranges(gen); @@ -1446,7 +1439,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_swap_arrays(gen); test_swap_arrays(gen); test_swap_arrays(gen); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ } template @@ -1963,7 +1955,9 @@ int main() { assert(test_constexpr()); #endif // _HAS_CXX20 run_randomized_tests_with_different_isa_levels([](mt19937_64& gen) { +#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_vector_algorithms(gen); +#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_various_containers(); test_bitset(gen); #ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC From 9edfa0ccd94334feaf5546b4fe06ba20f98b14b9 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 6 Mar 2026 20:32:05 +0200 Subject: [PATCH 4/7] test fallbacks separately --- .../tests/VSO_0000000_vector_algorithms/test.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index bfa99c11457..ffdbc509e4b 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1441,6 +1441,18 @@ void test_vector_algorithms(mt19937_64& gen) { test_swap_arrays(gen); } +void test_vector_algorithms_fallbacks(mt19937_64& gen) { + test_min_max_element(gen); + test_min_max_element(gen); + + test_min_max_element_pointers(gen); + + test_replace(gen); + test_replace(gen); + test_replace(gen); + test_replace(gen); +} + template void test_two_containers() { Container1 one = {10, 20, 30, 40, 50}; @@ -1957,7 +1969,9 @@ int main() { run_randomized_tests_with_different_isa_levels([](mt19937_64& gen) { #ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_vector_algorithms(gen); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ +#else // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) vvv + test_vector_algorithms_fallbacks(gen); +#endif // ^^^ defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_various_containers(); test_bitset(gen); #ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC From 35c4d8e61a02523926087d85d721f8c418d7ca20 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 6 Mar 2026 20:42:21 +0200 Subject: [PATCH 5/7] trim that --- tests/std/tests/VSO_0000000_vector_algorithms/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index ffdbc509e4b..b39ffb6703f 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1969,7 +1969,7 @@ int main() { run_randomized_tests_with_different_isa_levels([](mt19937_64& gen) { #ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_vector_algorithms(gen); -#else // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) vvv +#else // ^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) v test_vector_algorithms_fallbacks(gen); #endif // ^^^ defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_various_containers(); From f23ede273f637847055cfe699fe7c6077962d23e Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 6 Mar 2026 21:52:35 +0200 Subject: [PATCH 6/7] less is more --- tests/std/tests/VSO_0000000_vector_algorithms/test.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index b39ffb6703f..cc5fd085d62 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1969,13 +1969,12 @@ int main() { run_randomized_tests_with_different_isa_levels([](mt19937_64& gen) { #ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_vector_algorithms(gen); -#else // ^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) v - test_vector_algorithms_fallbacks(gen); -#endif // ^^^ defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ test_various_containers(); test_bitset(gen); -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC test_string(gen); +#else // ^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) v + test_vector_algorithms_fallbacks(gen); + test_bitset(gen); #endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ }); } From dd321924b42439db677d493c831442a26db6c471 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 6 Mar 2026 14:08:55 -0800 Subject: [PATCH 7/7] Inline helper, rearrange preprocessor, add comment. --- .../VSO_0000000_vector_algorithms/test.cpp | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp index cc5fd085d62..4a29aa63e8c 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms/test.cpp @@ -1441,18 +1441,6 @@ void test_vector_algorithms(mt19937_64& gen) { test_swap_arrays(gen); } -void test_vector_algorithms_fallbacks(mt19937_64& gen) { - test_min_max_element(gen); - test_min_max_element(gen); - - test_min_max_element_pointers(gen); - - test_replace(gen); - test_replace(gen); - test_replace(gen); - test_replace(gen); -} - template void test_two_containers() { Container1 one = {10, 20, 30, 40, 50}; @@ -1967,14 +1955,24 @@ int main() { assert(test_constexpr()); #endif // _HAS_CXX20 run_randomized_tests_with_different_isa_levels([](mt19937_64& gen) { -#ifndef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC +#ifdef _CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC + // Test the algorithms that *aren't* vectorized for ARM64EC: + test_min_max_element(gen); + test_min_max_element(gen); + + test_min_max_element_pointers(gen); + + test_replace(gen); + test_replace(gen); + test_replace(gen); + test_replace(gen); + + test_bitset(gen); +#else // ^^^ defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / normal test coverage vvv test_vector_algorithms(gen); test_various_containers(); test_bitset(gen); test_string(gen); -#else // ^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) / defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) v - test_vector_algorithms_fallbacks(gen); - test_bitset(gen); -#endif // ^^^ !defined(_CALL_ALL_X64_VECTOR_ALGORITHMS_ON_ARM64EC) ^^^ +#endif // ^^^ normal test coverage ^^^ }); }