Use stronger AVX2 detection in SIMD IndexOf/Includes

Bug: chromium:1392804
Change-Id: Ifd137a8c9547432a046c5510dcc2460d75807cd9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4071745
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84619}
This commit is contained in:
Darius M 2022-12-02 08:09:43 +01:00 committed by V8 LUCI CQ
parent be25ee7397
commit 74cc4e7d80

View File

@ -5,6 +5,7 @@
#include "src/objects/simd.h"
#include "src/base/cpu.h"
#include "src/codegen/cpu-features.h"
#include "src/objects/compressed-slots.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/heap-number-inl.h"
@ -39,8 +40,12 @@ enum class SimdKinds { kSSE, kNeon, kAVX2, kNone };
inline SimdKinds get_vectorization_kind() {
#ifdef __SSE3__
static base::CPU cpu;
if (cpu.has_avx2()) {
#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X64)
bool has_avx2 = CpuFeatures::IsSupported(AVX2);
#else
bool has_avx2 = false;
#endif
if (has_avx2) {
return SimdKinds::kAVX2;
} else {
// No need for a runtime check since we do not support x86/x64 CPUs without