Repository navigation
build: Make simd.h and thread.h compile for ARM64EC with clang-cl - #5635
Merged
lgritz merged 1 commit intoOct 29, 2026
Merged
Conversation
clang-cl defines _M_AMD64 and __x86_64__ for ARM64EC, so that data layouts match x64 code, but it provides no x86 intrinsics for it. - simd.h: the flush-to-zero and denormals functions use the SSE control register macros under __x86_64__. They also test !defined(__arm64ec__) now, so on ARM64EC they return false and do nothing, as on arm64. - thread.h: pause() called _mm_pause() under _M_AMD64. It takes the ARM64 branch (__dmb and __yield) for _M_ARM64EC now. This completes AcademySoftwareFoundation#5369, which switched simd.h to the NEON code path for ARM64EC. x86_64 builds are unchanged. Co-authored-by: Oscar Anson Assisted-by: Claude Code / Claude Opus 5.5 Signed-off-by: Thiago Ize <10453105+ThiagoIze@users.noreply.github.com>
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.
Description
clang-cl defines
_M_AMD64and__x86_64__when compiling ARM64EC code (sothat data layouts match x64), but its
intrin.hprovides no x86 intrinsics forthat target. #5369 switched
simd.hto the NEON code path for ARM64EC, but twoplaces still use x86 intrinsics there, so with clang-cl
simd.handthread.hstill fail to compile in an ARM64EC build. (MSVC doesn't define__x86_64__and emulates x64 intrinsics on ARM64EC, so the/arm64ECbuildfrom #5369 didn't hit this.)
simd.h:set_flush_zero_mode(),set_denorms_zero_mode(),get_flush_zero_mode()andget_denorms_zero_mode()use the SSE_MM_*control register macros under__x86_64__. They now also test!defined(__arm64ec__), so on ARM64EC they return false and do nothing,the same as on arm64.
thread.h: the MSVC branch ofpause()called_mm_pause()under_M_AMD64. For_M_ARM64ECit now takes the ARM64 branch (__dmband__yield).Nothing changes for real x86_64 builds.
Co-authored-by: Oscar Anson
Assisted-by: Claude Code / Claude Opus 5.5 (Claude helped Oscar diagnose the
ARM64EC compile errors and write the fix; Oscar reviewed it)
Tests
No testsuite change: CI has no ARM64EC build. We checked that the changed
headers compile with clang-cl for both ARM64EC and x86_64, and that OIIO
selects NEON for ARM64EC and SSE for x86_64.
Checklist:
and if I used AI coding assistants, I have an
Assisted-by: TOOL / MODELline in the pull request description above.
behavior.
PR, by pushing the changes to my fork and seeing that the automated CI
passed there. (Exceptions: If most tests pass and you can't figure out why
the remaining ones fail, it's ok to submit the PR and ask for help. Or if
any failures seem entirely unrelated to your change; sometimes things break
on the GitHub runners.)
fixed any problems reported by the clang-format CI test.
corresponding Python bindings. If altering ImageBufAlgo functions, I also
exposed the new functionality as oiiotool options.