Guard F16C intrinsic behind compiler feature macro#1
Closed
AuthenticSm1les wants to merge 1 commit intoMis012:with-patches-appliedfrom
Closed
Guard F16C intrinsic behind compiler feature macro#1AuthenticSm1les wants to merge 1 commit intoMis012:with-patches-appliedfrom
AuthenticSm1les wants to merge 1 commit intoMis012:with-patches-appliedfrom
Conversation
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.
Summary
Guard the AVX F16C skcms path behind F16C so generic x86_64 builds with Clang 22 do not try to use __builtin_ia32_vcvtph2ps256 when the compiler target does not enable F16C.
Root cause
The current code in modules/skcms/src/Transform_inl.h uses:
#elif defined(USING_AVX_F16C)
typedef int16_t attribute((vector_size(16))) I16;
return __builtin_ia32_vcvtph2ps256((I16)half);
In the failing package build, skcms.cc is compiled with a generic x86-64 target (-march=x86-64 -mtune=generic) and without -mf16c. Under Clang 22 that means the builtin is not declared, so the build fails with:
Why this change
Changing the condition to defined(USING_AVX_F16C) && defined(F16C) makes the fast path depend on the compiler target actually enabling F16C. If F16C is not enabled, the existing scalar fallback is used instead.
Impact
This unblocks the current AUR skia-sharp-atl build used by android_translation_layer on Arch Linux with Clang 22, while preserving the optimized path for builds that do enable F16C.
Validation