From 22f500fb9da0772db27d1ba782163558a1ad91fe Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Mon, 27 Jan 2025 12:38:42 -0800 Subject: [PATCH] fix movemask under gcc on ubuntu 24.04 aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Work around this error when building with gcc on aarch64: ``` In file included from folly/algorithm/simd/test/MovemaskTest.cpp:17: folly/algorithm/simd/Movemask.h: In instantiation of ‘uint64x1_t folly::simd::detail::asUint64x1Aarch64(Reg) [with Reg = __Uint64x1_t; uint64x1_t = uint64x1_t]’: folly/algorithm/simd/Movemask.h:174:66: required from ‘auto folly::simd::movemask_fn::operator()(Reg) const [with Reg = __Uint64x1_t; Scalar = long unsigned int]’ folly/algorithm/simd/test/MovemaskTest.cpp:62:3: required from ‘void folly::{anonymous}::allOneTrueTests() [with Reg = __Uint64x1_t; T = long unsigned int; long unsigned int N = 1]’ folly/algorithm/simd/test/MovemaskTest.cpp:191:48: required from here folly/algorithm/simd/Movemask.h:156:31: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts 156 | return vreinterpret_u64_u8(reg); | ~~~~~~~~~~~~~~~~~~~^~~~~ folly/algorithm/simd/Movemask.h:156:32: error: cannot convert ‘__Uint64x1_t’ to ‘__Uint8x8_t’ 156 | return vreinterpret_u64_u8(reg); | ^~~ | | | __Uint64x1_t In file included from /home/yfeldblum/proj/folly/folly/algorithm/simd/Movemask.h:32: /usr/lib/gcc/aarch64-linux-gnu/13/include/arm_neon.h:33:21: note: initializing argument 1 of ‘__Uint64x1_t vreinterpret_u64_u8(__Uint8x8_t)’ 33 | #pragma GCC aarch64 "arm_neon.h" | ^~~~~~~~~~~~ ``` Reviewed By: DenisYaroshevskiy Differential Revision: D68712982 fbshipit-source-id: 0c0a621755f879ad7b191f0fb171633bec0edf4f --- folly/algorithm/simd/Movemask.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folly/algorithm/simd/Movemask.h b/folly/algorithm/simd/Movemask.h index a092dbb1077..5b4e6b482da 100644 --- a/folly/algorithm/simd/Movemask.h +++ b/folly/algorithm/simd/Movemask.h @@ -148,7 +148,9 @@ FOLLY_ERASE auto movemaskChars16Aarch64(uint8x16_t reg) { template FOLLY_ERASE uint64x1_t asUint64x1Aarch64(Reg reg) { - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { + return reg; + } else if constexpr (std::is_same_v) { return vreinterpret_u64_u32(reg); } else if constexpr (std::is_same_v) { return vreinterpret_u64_u16(reg);