-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[builtins] Support building the 128-bit float functions on i386 #122658
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
base: main
Are you sure you want to change the base?
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,8 @@ | |||||||
#define QUAD_PRECISION | ||||||||
#include "fp_lib.h" | ||||||||
|
||||||||
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) | ||||||||
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ | ||||||||
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. This change is concerning. Not all 32-bit environments support FP80. Concretely, Windows, FreeBSD, and Darwin definitely do support FP80 even though the hardware does. This can make it easy to get ABI breakages. 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 only enable for linux 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. This should actually be checking
Suggested change
|
||||||||
(defined(__x86_64__) || defined(__i386__)) | ||||||||
#define SRC_80 | ||||||||
#define DST_QUAD | ||||||||
#include "fp_extend_impl.inc" | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,8 @@ | |||||||
#define QUAD_PRECISION | ||||||||
#include "fp_lib.h" | ||||||||
|
||||||||
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) | ||||||||
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ | ||||||||
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. Likewise |
||||||||
(defined(__x86_64__) || defined(__i386__)) | ||||||||
Comment on lines
+15
to
+16
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.
Suggested change
As above |
||||||||
|
||||||||
#define SRC_QUAD | ||||||||
#define DST_80 | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,10 @@ | ||||||||
// RUN: %clang_builtins %s %librt -o %t && %run %t | ||||||||
// RUN: %clang_builtins %s %librt -fforce-enable-int128 -o %t && %run %t | ||||||||
// REQUIRES: librt_has_extendxftf2 | ||||||||
|
||||||||
#include "int_lib.h" | ||||||||
#include <stdio.h> | ||||||||
|
||||||||
#if __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) && \ | ||||||||
#if __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__)) && \ | ||||||||
(defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)) | ||||||||
|
||||||||
Comment on lines
+7
to
8
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.
Suggested change
Since we include int_lib.h should be possible to simplify this |
||||||||
#include "fp_test.h" | ||||||||
|
@@ -28,7 +28,7 @@ char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0}; | |||||||
#endif | ||||||||
|
||||||||
int main() { | ||||||||
#if __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) && \ | ||||||||
#if __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__)) && \ | ||||||||
(defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)) | ||||||||
// qNaN | ||||||||
Comment on lines
+31
to
32
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.
Suggested change
Since we include int_lib.h should be possible to simplify this |
||||||||
if (test__extendxftf2(makeQNaN80(), UINT64_C(0x7fff800000000000), | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,10 @@ | ||||||||
// RUN: %clang_builtins %s %librt -o %t && %run %t | ||||||||
// RUN: %clang_builtins %s %librt -fforce-enable-int128 -o %t && %run %t | ||||||||
// REQUIRES: librt_has_trunctfxf2 | ||||||||
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. Will adding this flag unconditionally break other/older compilers? Maybe this needs to be a lit substitution? |
||||||||
|
||||||||
#include "int_lib.h" | ||||||||
#include <stdio.h> | ||||||||
|
||||||||
#if __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) && \ | ||||||||
#if __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__)) && \ | ||||||||
(defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)) | ||||||||
|
||||||||
Comment on lines
+7
to
8
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.
Suggested change
Since we include int_lib.h should be possible to simplify this |
||||||||
#include "fp_test.h" | ||||||||
|
@@ -28,7 +28,7 @@ char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0}; | |||||||
#endif | ||||||||
|
||||||||
int main() { | ||||||||
#if __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) && \ | ||||||||
#if __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__)) && \ | ||||||||
(defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)) | ||||||||
// qNaN | ||||||||
Comment on lines
+31
to
32
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.
Suggested change
Since we include int_lib.h should be possible to simplify this |
||||||||
if (test__trunctfxf2(makeQNaN128(), UINT64_C(0x7FFF), | ||||||||
|
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.
Do we support other compilers? If so enabling this unconditionally for i386 might break them?