Skip to content

Commit

Permalink
Adjust tests for x86 "Rust" ABI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beetrees committed Jul 12, 2024
1 parent 0f643c4 commit cae9d48
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
11 changes: 9 additions & 2 deletions tests/codegen/float/f128.rs
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions tests/codegen/float/f16.rs
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tests/codegen/issues/issue-32031.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 {
Expand Down
10 changes: 8 additions & 2 deletions tests/codegen/union-abi.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {}
Expand All @@ -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 {}
Expand Down

0 comments on commit cae9d48

Please sign in to comment.