Skip to content

Commit 1502090

Browse files
committed
[libc++] Ensure that we vectorize algorithms on all Clang-based compilers
Otherwise, we wouldn't vectorize on compilers like AppleClang when in reality we know perfectly well how to do it.
1 parent a0ae88b commit 1502090

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

libcxx/include/__algorithm/simd_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _LIBCPP_PUSH_MACROS
2626
#include <__undef_macros>
2727

2828
// TODO: Find out how altivec changes things and allow vectorizations there too.
29-
#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_CLANG_VER) && !defined(__ALTIVEC__)
29+
#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(__ALTIVEC__)
3030
# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 1
3131
#else
3232
# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// We don't know how to vectorize algorithms on GCC
10+
// XFAIL: gcc
11+
12+
// This test ensures that we enable the vectorization of algorithms on the expected
13+
// platforms.
14+
15+
#include <algorithm>
16+
17+
#if !_LIBCPP_VECTORIZE_ALGORITHMS
18+
# error Algorithms should be vectorized on this platform
19+
#endif

0 commit comments

Comments
 (0)