implement VaArgSafe for f128 - #161424
implement VaArgSafe for f128#161424folkertdev wants to merge 1 commit into
VaArgSafe for f128#161424Conversation
|
@bors try jobs=test-various,aarch64-apple-,-gnu-nopt-,x86_64-mingw-,aarch64-msvc-*,arm-android |
This comment has been minimized.
This comment has been minimized.
implement `VaArgSafe` for `f128` try-job: test-various try-job: aarch64-apple-* try-job: *-gnu-nopt-* try-job: x86_64-mingw-* try-job: aarch64-msvc-* try-job: arm-android
This comment has been minimized.
This comment has been minimized.
|
💔 Test for c9719b5 failed: CI. Failed job:
|
fdb79cb to
8a4f680
Compare
|
@bors try jobs=test-various,aarch64-apple-,-gnu-nopt-,x86_64-mingw-,aarch64-msvc-*,arm-android |
This comment has been minimized.
This comment has been minimized.
implement `VaArgSafe` for `f128` try-job: test-various try-job: aarch64-apple-* try-job: *-gnu-nopt-* try-job: x86_64-mingw-* try-job: aarch64-msvc-* try-job: arm-android
|
@rustbot ready |
8a4f680 to
4947d1f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c04a2f3 to
3d04167
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3d04167 to
a70355d
Compare
This comment has been minimized.
This comment has been minimized.
| // Clang 23 hits https://github.com/llvm/llvm-project/issues/217747. | ||
| all(target_arch = "x86", not(target_vendor = "apple"), not(target_env = "msvc")), | ||
| // PowerPC requires VSX - only little endian has it enabled by default. | ||
| all(target_arch = "powerpc64", target_endian = "little"), |
There was a problem hiding this comment.
Can this just use target_feature="vsx"?
There was a problem hiding this comment.
I changed it, though core is built without vsx so in practice the result is the same.
There was a problem hiding this comment.
I thought there may have been talks about an elfv2 BE target that requires VSX and thus could have it, but I may be misremembering
|
|
||
| #ifdef f128 | ||
| assert(test_rust(check_list_f128, (f128)-42.0, 0xAAAAAAAA, (f128)-INFINITY) == 0); | ||
| #endif |
There was a problem hiding this comment.
It would be better to load a literal for MAX since INFINITY only exercises the top 16 bits. E.g.:
union cvt128 {
struct {
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
uint64_t lo, hi;
#else
uint64_t hi, lo;
#endif
} i;
_Float128 f;
};
union cvt128 f128_max;
f128_max.i.hi = 0x7ffeffffffffffff;
f128_max.i.lo = 0xffffffffffffffff;
assert(test_rust(check_list_f128, (f128)-42.0, 0xAAAAAAAA, f128_max.f) == 0);Kind of annoying that llvm/llvm-project#97335 is still open and we can't just use __FLT128_MAX__.
| // Implement `VaArgSafe` for 128-bit integers on targets where either: | ||
| // | ||
| // - clang provides `__float128` | ||
| // - `long double` is IEEE f128 on the platform. | ||
| // | ||
| // When updating this cfg, also update the tests to match. Currently this condition | ||
| // is duplicated in: | ||
| // | ||
| // - tests/ui/c-variadic/roundtrip.rs | ||
| // - tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs |
There was a problem hiding this comment.
I checked against https://c.godbolt.org/z/7WGxKeq9v and everything seems to match up, with the exception of PPC64le. Unless I'm doing something wrong, it seems like Clang doesn't support it but GCC does? If that's accurate, the comment should be updated.
There was a problem hiding this comment.
Clang requires the -mfloat128 option for __float128 on PowerPC.
a70355d to
5aa1fbe
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
5aa1fbe to
5c2154a
Compare
This comment has been minimized.
This comment has been minimized.
5c2154a to
454d69a
Compare
| // Clang 23 hits https://github.com/llvm/llvm-project/issues/217747. | ||
| all(target_arch = "x86", not(target_vendor = "apple"), not(target_env = "msvc")), | ||
| // PowerPC requires VSX - only little endian has it enabled by default. | ||
| all(target_arch = "powerpc64", target_endian = "little"), |
There was a problem hiding this comment.
I changed it, though core is built without vsx so in practice the result is the same.
| #[unsafe(no_mangle)] | ||
| pub static RUST_HAS_F128: c_int = 1; |
There was a problem hiding this comment.
This is needed on powerpc64 where (at least my) GCC does have f128 support but our baseline does not.
|
This will clash with making @bors r- |
|
This pull request was unapproved. |
|
☔ The latest upstream changes (presumably #162909) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
On some platforms, especially when
long doubleis IEEE f128 on the platform.