Fix ARM64EC builds by excluding ARM64EC from x64(_M_X64) detection on Windows#265
Merged
aous72 merged 2 commits intoaous72:masterfrom Apr 8, 2026
Merged
Conversation
Owner
|
Thank you navvyswethgraphics for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue description
On Windows builds using MSVC, ARM64EC defines _M_X64 for source‑level compatibility.
As a result, ARM64EC builds were incorrectly classified as "OJPH_ARCH_X86_64", enabling x86-64 specific code paths and build flags. This leads to compilation failures due to unsupported intrinsics and incorrect ABI assumptions.
Build failure evidence (before fix)
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug ARM64EC ------
1>1>Checking Build System
2>------ Rebuild All started: Project: openjph, Configuration: Debug ARM64EC ------
2>Compiling...
2>Generating Code...
2>ojph_mem_c.c
2>cl : command line warning D9002: ignoring unknown option '/arch:AVX'
2>ojph_codestream_avx.cpp
2>ojph_colour_avx.cpp
2>ojph_transform_avx.cpp
2>Generating Code...
2>C:\FORK\TEMP\OpenJPH\src\core\transform\ojph_transform_avx.cpp(1,1): error C7302: AVX types (__m256) are not currently supported in ARM64EC code
2>C:\FORK\TEMP\OpenJPH\src\core\codestream\ojph_codestream_avx.cpp(1,1): error C7302: AVX types (__m256) are not currently supported in ARM64EC code
2>Done building project "openjph.vcxproj" -- FAILED.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 11:54 AM and took 09.063 seconds ==========
Type of change
The #else block applies to Linux/FreeBSD/OpenBSD builds and is therefore never selected for Windows ARM64 or ARM64EC.
While _M_ARM64EC is not strictly required here, it is included alongside _M_ARM64 for consistency with the existing ARM64 detection logic.
Impact
Build & Test