Adjust tests for x86 "Rust" ABI changes

This commit is contained in:
beetrees 2024-07-03 13:41:36 +01:00
parent 0f643c449a
commit cae9d480bf
No known key found for this signature in database
GPG Key ID: 8791BD754191EBD6
4 changed files with 34 additions and 8 deletions

View File

@ -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 f128
#![crate_type = "lib"]
@ -138,14 +143,16 @@ pub fn f128_as_f16(a: f128) -> f16 {
a as f16
}
// CHECK-LABEL: float @f128_as_f32(
// other-LABEL: float @f128_as_f32(
// x86-LABEL: i32 @f128_as_f32(
#[no_mangle]
pub fn f128_as_f32(a: f128) -> f32 {
// CHECK: fptrunc fp128 %{{.+}} to float
a as f32
}
// CHECK-LABEL: double @f128_as_f64(
// other-LABEL: double @f128_as_f64(
// x86-LABEL: void @f128_as_f64(
#[no_mangle]
pub fn f128_as_f64(a: f128) -> f64 {
// CHECK: fptrunc fp128 %{{.+}} to double

View File

@ -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

View File

@ -1,11 +1,16 @@
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
// 32-bit x86 returns `f32` and `f64` differently to avoid the x87 stack.
//@ revisions: x86 other
//@[x86] only-x86
//@[other] ignore-x86
#![crate_type = "lib"]
#[no_mangle]
pub struct F32(f32);
// CHECK: define{{.*}}float @add_newtype_f32(float %a, float %b)
// other: define{{.*}}float @add_newtype_f32(float %a, float %b)
// x86: define{{.*}}i32 @add_newtype_f32(float %a, float %b)
#[inline(never)]
#[no_mangle]
pub fn add_newtype_f32(a: F32, b: F32) -> F32 {
@ -15,7 +20,8 @@ pub fn add_newtype_f32(a: F32, b: F32) -> F32 {
#[no_mangle]
pub struct F64(f64);
// CHECK: define{{.*}}double @add_newtype_f64(double %a, double %b)
// other: define{{.*}}double @add_newtype_f64(double %a, double %b)
// x86: define{{.*}}void @add_newtype_f64(ptr{{.*}}sret([8 x i8]){{.*}}%_0, double %a, double %b)
#[inline(never)]
#[no_mangle]
pub fn add_newtype_f64(a: F64, b: F64) -> F64 {

View File

@ -1,5 +1,9 @@
//@ ignore-emscripten vectors passed directly
//@ compile-flags: -O -C no-prepopulate-passes
// 32-bit x86 returns `f32` differently to avoid the x87 stack.
//@ revisions: x86 other
//@[x86] only-x86
//@[other] ignore-x86
// This test that using union forward the abi of the inner type, as
// discussed in #54668
@ -67,7 +71,8 @@ pub union UnionF32 {
a: f32,
}
// CHECK: define {{(dso_local )?}}float @test_UnionF32(float %_1)
// other: define {{(dso_local )?}}float @test_UnionF32(float %_1)
// x86: define {{(dso_local )?}}i32 @test_UnionF32(float %_1)
#[no_mangle]
pub fn test_UnionF32(_: UnionF32) -> UnionF32 {
loop {}
@ -78,7 +83,8 @@ pub union UnionF32F32 {
b: f32,
}
// CHECK: define {{(dso_local )?}}float @test_UnionF32F32(float %_1)
// other: define {{(dso_local )?}}float @test_UnionF32F32(float %_1)
// x86: define {{(dso_local )?}}i32 @test_UnionF32F32(float %_1)
#[no_mangle]
pub fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 {
loop {}