diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h index e3c790998e902..5508cef292a59 100644 --- a/libcxx/include/__algorithm/simd_utils.h +++ b/libcxx/include/__algorithm/simd_utils.h @@ -26,7 +26,9 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> // TODO: Find out how altivec changes things and allow vectorizations there too. -#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_CLANG_VER) && !defined(__ALTIVEC__) +// TODO: Simplify this condition once we stop building with AppleClang 15 in the CI. +#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(__ALTIVEC__) && \ + !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1600) # define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 1 #else # define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0 diff --git a/libcxx/test/libcxx/algorithms/vectorization.compile.pass.cpp b/libcxx/test/libcxx/algorithms/vectorization.compile.pass.cpp new file mode 100644 index 0000000000000..733a147b80cc3 --- /dev/null +++ b/libcxx/test/libcxx/algorithms/vectorization.compile.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// We don't know how to vectorize algorithms on GCC +// XFAIL: gcc + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +// We don't vectorize algorithms before C++14 +// XFAIL: c++03, c++11 + +// We don't vectorize algorithms on AIX right now. +// XFAIL: target={{.+}}-aix{{.*}} + +// We don't vectorize on AppleClang 15 since that apparently breaks std::mismatch +// XFAIL: apple-clang-15 + +// This test ensures that we enable the vectorization of algorithms on the expected +// platforms. + +#include + +#ifndef _LIBCPP_VECTORIZE_ALGORITHMS +# error It looks like the test needs to be updated since _LIBCPP_VECTORIZE_ALGORITHMS isn't defined anymore +#endif + +#if !_LIBCPP_VECTORIZE_ALGORITHMS +# error Algorithms should be vectorized on this platform +#endif