Skip to content

Commit 1e03581

Browse files
authored
Only enable NEON on AArch64 (#141)
AArch32 also has NEON, but lacks some of the intrinsics needed. Explicitly check for presence of an AArch64-only intrinsic to make the NEON check fail on AArch32. Fixes #102
1 parent bbb68f1 commit 1e03581

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ if (LIBDIVIDE_BUILD_TESTS AND NOT CMAKE_CROSSCOMPILING)
9898
#include <arm_neon.h>
9999
int main()
100100
{
101-
#if !defined(__ARM_NEON)
102-
#error not ARM NEON CPU architecture
103-
#endif
104-
return 0;
101+
int32x4_t a = vdupq_n_s32(0);
102+
/* only available on AArch64 */
103+
vuzp2q_s32(a, a);
104+
return *(int *)&a;
105105
}"
106106
CPU_ARM_NEON)
107107
if (CPU_X86 OR CPU_ARM_NEON)
@@ -165,6 +165,8 @@ else()
165165
int main()
166166
{
167167
int32x4_t a = vdupq_n_s32(0);
168+
/* only available on AArch64 */
169+
vuzp2q_s32(a, a);
168170
return *(int *)&a;
169171
}")
170172
if (CMAKE_CROSSCOMPILING)

0 commit comments

Comments
 (0)