Commit 0fc6592c authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by V8 LUCI CQ

GCC: fix compilation of NEON64 extract_first_nonzero_index

GCC fails to compile extract_first_nonzero_index because of the
signedness type mismatch in the NEON intrinsics.

Bug: chromium:819294
Change-Id: I9b73e5fa1d5fbf161740ab1b5d77f5c494369dfa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3693709Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#81063}
parent ecad9dc2
...@@ -95,24 +95,21 @@ inline int extract_first_nonzero_index(T v) { ...@@ -95,24 +95,21 @@ inline int extract_first_nonzero_index(T v) {
} }
template <> template <>
inline int extract_first_nonzero_index(int32x4_t v) { inline int extract_first_nonzero_index(uint32x4_t v) {
int32x4_t mask = {4, 3, 2, 1}; uint32x4_t mask = {4, 3, 2, 1};
mask = vandq_u32(mask, v); mask = vandq_u32(mask, v);
return 4 - vmaxvq_u32(mask); return 4 - vmaxvq_u32(mask);
} }
template <> template <>
inline int extract_first_nonzero_index(int64x2_t v) { inline int extract_first_nonzero_index(uint64x2_t v) {
int32x4_t mask = {2, 0, 1, 0}; // Could also be {2,2,1,1} or {0,2,0,1} uint32x4_t mask = {2, 0, 1, 0}; // Could also be {2,2,1,1} or {0,2,0,1}
mask = vandq_u32(mask, vreinterpretq_s32_s64(v)); mask = vandq_u32(mask, vreinterpretq_u32_u64(v));
return 2 - vmaxvq_u32(mask); return 2 - vmaxvq_u32(mask);
} }
template <> inline int32_t reinterpret_vmaxvq_u64(uint64x2_t v) {
inline int extract_first_nonzero_index(float64x2_t v) { return vmaxvq_u32(vreinterpretq_u32_u64(v));
int32x4_t mask = {2, 0, 1, 0}; // Could also be {2,2,1,1} or {0,2,0,1}
mask = vandq_u32(mask, vreinterpretq_s32_f64(v));
return 2 - vmaxvq_u32(mask);
} }
#endif #endif
...@@ -204,14 +201,14 @@ inline uintptr_t fast_search_noavx(T* array, uintptr_t array_len, ...@@ -204,14 +201,14 @@ inline uintptr_t fast_search_noavx(T* array, uintptr_t array_len,
} }
#elif defined(NEON64) #elif defined(NEON64)
if constexpr (std::is_same<T, uint32_t>::value) { if constexpr (std::is_same<T, uint32_t>::value) {
VECTORIZED_LOOP_Neon(int32x4_t, int32x4_t, vdupq_n_u32, vceqq_u32, VECTORIZED_LOOP_Neon(uint32x4_t, uint32x4_t, vdupq_n_u32, vceqq_u32,
vmaxvq_u32) vmaxvq_u32)
} else if constexpr (std::is_same<T, uint64_t>::value) { } else if constexpr (std::is_same<T, uint64_t>::value) {
VECTORIZED_LOOP_Neon(int64x2_t, int64x2_t, vdupq_n_u64, vceqq_u64, VECTORIZED_LOOP_Neon(uint64x2_t, uint64x2_t, vdupq_n_u64, vceqq_u64,
vmaxvq_u32) reinterpret_vmaxvq_u64)
} else if constexpr (std::is_same<T, double>::value) { } else if constexpr (std::is_same<T, double>::value) {
VECTORIZED_LOOP_Neon(float64x2_t, float64x2_t, vdupq_n_f64, vceqq_f64, VECTORIZED_LOOP_Neon(float64x2_t, uint64x2_t, vdupq_n_f64, vceqq_f64,
vmaxvq_f64) reinterpret_vmaxvq_u64)
} }
#else #else
UNREACHABLE(); UNREACHABLE();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment