[libcxx-commits] [libcxx] af57ad6 - [libc++][z/OS] Correct a definition of __native_vector_size (#91995)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 16 05:58:47 PDT 2024


Author: zibi2
Date: 2024-05-16T08:58:44-04:00
New Revision: af57ad6536c7df19e6df7217d9d976067fdaf882

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

LOG: [libc++][z/OS] Correct a definition of __native_vector_size (#91995)

Fix `std/ranges/range.adaptors/range.lazy.split/general.pass.cpp` which
started failing on z/OS after this
[commit](https://github.com/llvm/llvm-project/commit/985c1a44f8d49e0af).

This test case is passing on other platforms such as AIX. This is
because the `__ALTIVEC__` macro is defined and `__mismatch` under
`_LIBCPP_VECTORIZE_ALGORITHMS` guard is compiled out. However, on z/OS
`_LIBCPP_VECTORIZE_ALGORITHMS` is defined. Analyzing the algorithm of
`__mismatch` shows that the culprit is the definition of
`__native_vector_size` which was defined wrongly as 1. This PR corrects
the definition of `__native_vector_size` and fixes the affected test.

Added: 
    

Modified: 
    libcxx/include/__algorithm/simd_utils.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index 71d65e8f4afb5..aa4336a2214c8 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -74,7 +74,7 @@ using __get_as_integer_type_t = typename __get_as_integer_type_impl<sizeof(_Tp)>
 // This isn't specialized for 64 byte vectors on purpose. They have the potential to significantly reduce performance
 // in mixed simd/non-simd workloads and don't provide any performance improvement for currently vectorized algorithms
 // as far as benchmarks are concerned.
-#  if defined(__AVX__)
+#  if defined(__AVX__) || defined(__MVS__)
 template <class _Tp>
 inline constexpr size_t __native_vector_size = 32 / sizeof(_Tp);
 #  elif defined(__SSE__) || defined(__ARM_NEON__)


        


More information about the libcxx-commits mailing list