Skip to content

simd: fix MSVC ARM64 build with SJPEG_NEON16_OP/8_OP - #211

Merged
jzern merged 2 commits into
mainfrom
skal/fix-neon16-op-msvc
Sep 30, 2026
Merged

jzern merged 2 commits into
mainfrom
skal/fix-neon16-op-msvc

Conversation

@skal65535

Copy link
Copy Markdown
Collaborator
  • MSVC aliases all NEONxx_t types to one __n128/__n64 union
  • => duplicate operator overloads, C2535
  • skip extra conversions for MSVC (not clang-cl, distinct types there)

* MSVC aliases all NEONxx_t types to one __n128/__n64 union
* => duplicate operator overloads, C2535
* skip extra conversions for MSVC (not clang-cl, distinct types there)
@jzern

jzern commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Let me verify this before submitting.

@jzern

jzern commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Closer, now the same thing for Store16_NEON:

src\simd.h(192,1): error C2084: function 'void Store16_NEON(uint8x16_t,void *)' already has a body

@jzern

jzern commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Closer, now the same thing for Store16_NEON:

src\simd.h(192,1): error C2084: function 'void Store16_NEON(uint8x16_t,void *)' already has a body

Updating that to match passes. Note I also have the following addition to enable NEON. Noticed the failure when I was getting ready to push the patch.

diff --git a/src/simd.h b/src/simd.h
index 2636e41..bfb892d 100644
--- a/src/simd.h
+++ b/src/simd.h
@@ -34,7 +34,9 @@
 #define SJPEG_USE_AVX2
 #endif

-#if !defined(SJPEG_USE_NEON) && (defined(__ARM_NEON__) || defined(__aarch64__))
+#if !defined(SJPEG_USE_NEON) &&                                          \
+    (defined(__ARM_NEON__) || defined(__aarch64__) || defined(_M_ARM) || \
+     defined(_M_ARM64) || defined(_M_ARM64EC))
 #define SJPEG_USE_NEON
 #endif

@jzern

jzern commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

clang-cl builds with the above changes.

@skal65535

Copy link
Copy Markdown
Collaborator Author

LGTM

+ enable NEON for MSVC arm targets
@jzern
jzern force-pushed the skal/fix-neon16-op-msvc branch from 0cb739a to c291d96 Compare September 30, 2026 18:50
@jzern
jzern merged commit 0175113 into main Sep 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants