diff options
| author | bors <bors@rust-lang.org> | 2024-07-12 20:36:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-12 20:36:43 +0000 |
| commit | c6727fc9b5c64cefa7263486497ee95e529bd0f8 (patch) | |
| tree | 97a13f2f6b89c85feb20239b77a14958fea7083c /tests/codegen/float/f16.rs | |
| parent | 62c068feeafd1f4abbf87243d69cf8862e4dd277 (diff) | |
| parent | cae9d480bfe930a678fe2744082fc6ef1d957f63 (diff) | |
| download | rust-c6727fc9b5c64cefa7263486497ee95e529bd0f8.tar.gz rust-c6727fc9b5c64cefa7263486497ee95e529bd0f8.zip | |
Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubilee
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86 Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
Diffstat (limited to 'tests/codegen/float/f16.rs')
| -rw-r--r-- | tests/codegen/float/f16.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/codegen/float/f16.rs b/tests/codegen/float/f16.rs index 96daac869c2..2910d7d3e92 100644 --- a/tests/codegen/float/f16.rs +++ b/tests/codegen/float/f16.rs @@ -1,3 +1,8 @@ +// 32-bit x86 returns `f32` and `f64` differently to avoid the x87 stack. +//@ revisions: x86 other +//@[x86] only-x86 +//@[other] ignore-x86 + // Verify that our intrinsics generate the correct LLVM calls for f16 #![crate_type = "lib"] @@ -140,14 +145,16 @@ pub fn f16_as_self(a: f16) -> f16 { a as f16 } -// CHECK-LABEL: float @f16_as_f32( +// other-LABEL: float @f16_as_f32( +// x86-LABEL: i32 @f16_as_f32( #[no_mangle] pub fn f16_as_f32(a: f16) -> f32 { // CHECK: fpext half %{{.+}} to float a as f32 } -// CHECK-LABEL: double @f16_as_f64( +// other-LABEL: double @f16_as_f64( +// x86-LABEL: void @f16_as_f64( #[no_mangle] pub fn f16_as_f64(a: f16) -> f64 { // CHECK: fpext half %{{.+}} to double |
