Skip to content

Commit 78806eb

Browse files
cosmo0920edsiper
authored andcommitted
simd: Detect NEON extension on ARM64 Windows correctly
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 210ca30 commit 78806eb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

include/fluent-bit/flb_simd.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
typedef __m128i flb_vector8;
4646
typedef __m128i flb_vector32;
4747

48-
#elif defined(__aarch64__) && defined(__ARM_NEON)
48+
#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
4949
/*
5050
* We use the Neon instructions if the compiler provides access to them (as
5151
* indicated by __ARM_NEON) and we are on aarch64. While Neon support is
@@ -54,7 +54,16 @@ typedef __m128i flb_vector32;
5454
* could not realistically use it there without a run-time check, which seems
5555
* not worth the trouble for now.
5656
*/
57-
#include <arm_neon.h>
57+
#ifndef __ARM_NEON
58+
#define __ARM_NEON 1
59+
#endif
60+
#if __has_include(<arm_neon.h>)
61+
#include <arm_neon.h>
62+
#elif __has_include(<arm64_neon.h>)
63+
#include <arm64_neon.h>
64+
#else
65+
#error "NEON intrinsics header not found on this toolchain"
66+
#endif
5867
#define FLB_SIMD_NEON
5968
typedef uint8x16_t flb_vector8;
6069
typedef uint32x4_t flb_vector32;

0 commit comments

Comments
 (0)