Skip to content

Commit d356533

Browse files
joyeecheungtargos
authored andcommitted
deps: V8: cherry-pick 68cf9ecd884b
Original commit message: [simd] Disable SVE implementation of array search for GCC GCC requires SVE enabled for the entire translation unit and does not expose raw __builtin_sve_* builtins on a per-function basis. Fallback to Neon if it's not built by Clang. Refs: nodejs#65161 Change-Id: I53a06fcf8f901ae0347044c6999463ce99215c45 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8223266 Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Joyee Cheung <joyee@igalia.com> Cr-Commit-Position: refs/heads/main@{#109230} Refs: v8/v8@68cf9ec
1 parent 4fd114f commit d356533

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎common.gypi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
# Reset this number to 0 on major V8 upgrades.
4444
# Increment by one for each non-official patch applied to deps/v8.
45-
'v8_embedder_string': '-node.8',
45+
'v8_embedder_string': '-node.9',
4646

4747
##### V8 defaults for Node.js #####
4848

‎deps/v8/src/objects/simd.cc‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ uintptr_t fast_search_avx(T* array, uintptr_t array_len, uintptr_t index,
348348
}
349349
#endif // ifdef __SSE3__
350350

351-
#ifdef NEON64
351+
// When built with other toolchains, do not count on it to expose
352+
// __builtin_sve_* on a per-function basis. Fallback to Neon.
353+
#if defined(NEON64) && defined(__clang__)
354+
#define V8_ENABLE_SIMD_SVE 1
352355

353356
template <typename ScalarType>
354357
struct SVEOperations {
@@ -628,7 +631,7 @@ TARGET_SVE inline uintptr_t fast_search_sve(T* array, uintptr_t array_len,
628631
return no_match;
629632
}
630633

631-
#endif // NEON64
634+
#endif // defined(NEON64) && defined(__clang__)
632635

633636
#undef IS_CLANG_WIN
634637
#undef VECTORIZED_LOOP_Neon
@@ -637,15 +640,15 @@ TARGET_SVE inline uintptr_t fast_search_sve(T* array, uintptr_t array_len,
637640
template <typename T>
638641
inline uintptr_t search(T* array, uintptr_t array_len, uintptr_t index,
639642
T search_element) {
640-
#ifdef NEON64
643+
#ifdef V8_ENABLE_SIMD_SVE
641644
if (get_vectorization_kind() == SimdKinds::kSVE) {
642645
return fast_search_sve(array, array_len, index, search_element);
643646
}
644-
#else
647+
#elif !defined(NEON64)
645648
if (get_vectorization_kind() == SimdKinds::kAVX2) {
646649
return fast_search_avx(array, array_len, index, search_element);
647650
}
648-
#endif // NEON64
651+
#endif
649652

650653
return fast_search_noavx(array, array_len, index, search_element);
651654
}

0 commit comments

Comments
 (0)