Skip to content

Commit

Permalink
fix movemask under gcc on ubuntu 24.04 aarch64
Browse files Browse the repository at this point in the history
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<Scalar>::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
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 27, 2025
1 parent 5009049 commit 22f500f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion folly/algorithm/simd/Movemask.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ FOLLY_ERASE auto movemaskChars16Aarch64(uint8x16_t reg) {

template <typename Reg>
FOLLY_ERASE uint64x1_t asUint64x1Aarch64(Reg reg) {
if constexpr (std::is_same_v<Reg, uint32x2_t>) {
if constexpr (std::is_same_v<Reg, uint64x1_t>) {
return reg;
} else if constexpr (std::is_same_v<Reg, uint32x2_t>) {
return vreinterpret_u64_u32(reg);
} else if constexpr (std::is_same_v<Reg, uint16x4_t>) {
return vreinterpret_u64_u16(reg);
Expand Down

0 comments on commit 22f500f

Please sign in to comment.