-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating-point arithmetic on 386/x87 (32-bit) #785
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mut | ||
crate | ||
arithmetics |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -71,6 +71,14 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Clang) | |||||||||
endif() | ||||||||||
endif() | ||||||||||
|
||||||||||
# This currently is for checking 32-bit mode on x86_64. | ||||||||||
# TODO: potentially include x86, i386, i686 here | ||||||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about sorting it out with:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also just realised that basically this check here enables "32-bit mode support" as opposed to supporting x86. Maybe just documenting that too is good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chfast please add this and then we can merge Also see #785 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make the required changes yourself. |
||||||||||
# On 32-bit opt-in for floating-point implementation with SSE2. | ||||||||||
# See the "x87 FPU" section in the README for explanation. | ||||||||||
add_compile_options(-msse2 -mfpmath=sse) | ||||||||||
endif() | ||||||||||
|
||||||||||
# An option to enable assertions in non-Debug build types. | ||||||||||
# Disabling assertions in Debug build type has no effect (assertions are still enabled). | ||||||||||
option(ENABLE_ASSERTIONS "Enable NDEBUG based assertions" OFF) | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,14 +30,9 @@ if(TESTFLOAT_GEN) | |
list(APPEND IGNORE_LIST ui64_to_f64/min) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
# TODO: On i386 (32-bit) there are bugs in the arithmetic instructions | ||
# with default rounding. | ||
list(APPEND IGNORE_LIST | ||
f64_add/near_even | ||
f64_sub/near_even | ||
f64_mul/near_even | ||
f64_div/near_even) | ||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_CXX_COMPILER_ID MATCHES GNU) | ||
# TODO: GCC 32-bit i386 build produces -0 for input 0, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100119. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Supposedly fixed in gcc 12. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still doesn't work:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bug is indeed fixed in GCC 12.1. Are you sure we are using GCC 12? Maybe there is some other bug lurking here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ran it on the CI, which I believed had 12, but now on a second look it is 11. |
||
list(APPEND IGNORE_LIST ui32_to_f64/min) | ||
endif() | ||
|
||
set(ROUNDING_MODES near_even minMag min max) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x86_64
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's different on true 386, but I have not way of checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure it should be
i386
on any non-64-bit x86 (at some point they tried to retrofitia32
though).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can fixed if someone would use such system (I doubt this will ever happen). At this point I'm not sure what name CMake uses because this is not specified except they mention
uname
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some search suggest that it may return the following:
x86
,i386
,i686
.See https://boringssl.googlesource.com/boringssl/+/refs/heads/2272/CMakeLists.txt and http://www.autoscool-clermont.com/blum/wp-content/themes/matrix/inc/kirki/assets/js/vendor/codemirror/mode/cmake/index.html (which has
set(X86_ALIASES x86 i386 i686 x86_64 amd64)
).