fix build on i386 without SSE2#302
Merged
thiagomacieira merged 1 commit intointel:mainfrom Aug 19, 2025
Merged
Conversation
Commit 3cba6b1 ("Use _Float16 for half conversions if available") added support for using half-width float support in the compiler to perform encoding operations, using the FLT16_MANT_DIG macro to check for support on the given target. However, on x86 GCC only supports this when SSE2 is enabled[1]. Unlike clang and the other architectures where support for this is conditional, GCC *does* define those macros even without SSE2 support, causing a build failure: In file included from cborencoder_float.c:29: cborinternal_p.h: In function ‘encode_half’: cborinternal_p.h:56:5: error: invalid conversion to type ‘_Float16’ without option ‘-msse2’ 56 | _Float16 f = (_Float16)x; | ^~~~~~~~ cborinternal_p.h: In function ‘decode_half’: cborinternal_p.h:65:5: error: invalid conversion from type ‘_Float16’ without option ‘-msse2’ 65 | return (float)f; | Work around this by additionally checking for this specific condition. [1] https://gcc.gnu.org/onlinedocs/gcc/Half-Precision.html Signed-off-by: Florian Larysch <fl@n621.de>
Member
|
Thank you for the patch. |
thiagomacieira
approved these changes
Aug 19, 2025
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.
Commit 3cba6b1 ("Use _Float16 for half conversions if available") added support for using half-width float support in the compiler to perform encoding operations, using the FLT16_MANT_DIG macro to check for support on the given target.
However, on x86 GCC only supports this when SSE2 is enabled[1]. Unlike clang and the other architectures where support for this is conditional, GCC does define those macros even without SSE2 support, causing a build failure:
Work around this by additionally checking for this specific condition.
[1] https://gcc.gnu.org/onlinedocs/gcc/Half-Precision.html