From 088c0b7ac43606de4a960cf859397a5f3ce0f0d7 Mon Sep 17 00:00:00 2001 From: Steve Wishnousky Date: Fri, 12 Mar 2021 13:43:51 -0800 Subject: [PATCH 1/6] Add escape hatch for _USE_STD_VECTOR_ALGORITHMS. --- stl/inc/xutility | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stl/inc/xutility b/stl/inc/xutility index 2179e1251fd..70619556317 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -21,11 +21,13 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +#ifndef _USE_STD_VECTOR_ALGORITHMS #if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC) #define _USE_STD_VECTOR_ALGORITHMS 1 #else #define _USE_STD_VECTOR_ALGORITHMS 0 #endif +#endif #ifdef __CUDACC__ #define _CONSTEXPR_BIT_CAST inline From 4940c1e8ffffa24782f06555788124ed2bf08252 Mon Sep 17 00:00:00 2001 From: Steve Wishnousky Date: Wed, 17 Mar 2021 10:25:37 -0700 Subject: [PATCH 2/6] Add endif comment --- stl/inc/xutility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index 70619556317..b503f5055c1 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -27,7 +27,7 @@ _STL_DISABLE_CLANG_WARNINGS #else #define _USE_STD_VECTOR_ALGORITHMS 0 #endif -#endif +#endif // _USE_STD_VECTOR_ALGORITHMS #ifdef __CUDACC__ #define _CONSTEXPR_BIT_CAST inline From 8d449ca50e388e704e72749ff76a533a17b9df1b Mon Sep 17 00:00:00 2001 From: Steve Wishnousky Date: Wed, 17 Mar 2021 19:43:38 -0700 Subject: [PATCH 3/6] Ensure escape hatch will error if configuration is unsupported. --- stl/inc/xutility | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index b503f5055c1..baf0d2f0451 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -21,13 +21,18 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new +#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) \ + && !defined(_M_HYBRID) && !defined(_M_ARM64EC) #ifndef _USE_STD_VECTOR_ALGORITHMS -#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC) #define _USE_STD_VECTOR_ALGORITHMS 1 -#else -#define _USE_STD_VECTOR_ALGORITHMS 0 #endif +#else // ^^^ arch supports vector algorithms / no support for vector algorithms vvv +#ifndef _USE_STD_VECTOR_ALGORITHMS +#define _USE_STD_VECTOR_ALGORITHMS 0 +#elif _USE_STD_VECTOR_ALGORITHMS +#error Vector algorithms are not supported on this architecture, but _USE_STD_VECTOR_ALGORITHMS is set. #endif // _USE_STD_VECTOR_ALGORITHMS +#endif // ^^^ no support for vector algorithms ^^^ #ifdef __CUDACC__ #define _CONSTEXPR_BIT_CAST inline From 7ca681e20844b90ffd991820afe77a80edf6c7f5 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Wed, 17 Mar 2021 22:57:54 -0700 Subject: [PATCH 4/6] Update stl/inc/xutility Unwrap line that fits in 120 columns. --- stl/inc/xutility | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index baf0d2f0451..3a93e64c7e6 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -21,8 +21,7 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) \ - && !defined(_M_HYBRID) && !defined(_M_ARM64EC) +#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC) #ifndef _USE_STD_VECTOR_ALGORITHMS #define _USE_STD_VECTOR_ALGORITHMS 1 #endif From 4533183e0c9d200f0c75516291e6c4519a1b4981 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 19 Mar 2021 18:08:25 -0700 Subject: [PATCH 5/6] Add preprocessor comment --- stl/inc/xutility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index 3a93e64c7e6..56ffd264431 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -24,7 +24,7 @@ _STL_DISABLE_CLANG_WARNINGS #if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC) #ifndef _USE_STD_VECTOR_ALGORITHMS #define _USE_STD_VECTOR_ALGORITHMS 1 -#endif +#endif // _USE_STD_VECTOR_ALGORITHMS #else // ^^^ arch supports vector algorithms / no support for vector algorithms vvv #ifndef _USE_STD_VECTOR_ALGORITHMS #define _USE_STD_VECTOR_ALGORITHMS 0 From 565ee51b05cfb126e38482c049be992c45205d49 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 19 Mar 2021 18:20:42 -0700 Subject: [PATCH 6/6] Test the escape hatch. --- tests/std/tests/VSO_0000000_vector_algorithms/env.lst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms/env.lst b/tests/std/tests/VSO_0000000_vector_algorithms/env.lst index 19f025bd0e6..2e61ef96b9c 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms/env.lst +++ b/tests/std/tests/VSO_0000000_vector_algorithms/env.lst @@ -2,3 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception RUNALL_INCLUDE ..\usual_matrix.lst +RUNALL_CROSSLIST +PM_CL="" # Test default setting +PM_CL="/D_USE_STD_VECTOR_ALGORITHMS=0" # Test escape hatch, see GH-1751