Skip to content

Commit

Permalink
NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case s…
Browse files Browse the repository at this point in the history
…ince it was used as an example when discussing possible problems
  • Loading branch information
Kjetil Kjeka committed May 31, 2024
1 parent 14348d9 commit a49fe0a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/assembly/nvptx-c-abi-arg-v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ pub struct TripleU16 {
h: u16,
}
#[repr(C)]
pub struct DoubleI32 {
f: i32,
g: i32,
}
#[repr(C)]
pub struct TripleU32 {
f: u32,
g: u32,
Expand Down Expand Up @@ -175,6 +180,11 @@ pub unsafe extern "C" fn f_triple_u16_arg(_a: TripleU16) {}
#[no_mangle]
pub unsafe extern "C" fn f_triple_u32_arg(_a: TripleU32) {}

// CHECK: .visible .func f_double_i32_arg(
// CHECK: .param .align 4 .b8 f_double_i32_arg_param_0[8]
#[no_mangle]
pub unsafe extern "C" fn f_double_i32_arg(_a: DoubleI32) {}

// CHECK: .visible .func f_triple_u64_arg(
// CHECK: .param .align 8 .b8 f_triple_u64_arg_param_0[24]
#[no_mangle]
Expand Down
11 changes: 11 additions & 0 deletions tests/assembly/nvptx-c-abi-ret-v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ pub struct TripleU16 {
h: u16,
}
#[repr(C)]
pub struct DoubleI32 {
f: i32,
g: i32,
}
#[repr(C)]
pub struct TripleU32 {
f: u32,
g: u32,
Expand Down Expand Up @@ -186,6 +191,12 @@ pub unsafe extern "C" fn f_triple_u16_ret() -> TripleU16 {
TripleU16 { f: 18, g: 19, h: 20 }
}

// CHECK: .visible .func (.param .align 4 .b8 func_retval0[8]) f_double_i32_ret(
#[no_mangle]
pub unsafe extern "C" fn f_double_i32_ret() -> DoubleI32 {
DoubleI32 { f: 1, g: 2 }
}

// CHECK: .visible .func (.param .align 4 .b8 func_retval0[12]) f_triple_u32_ret(
#[no_mangle]
pub unsafe extern "C" fn f_triple_u32_ret() -> TripleU32 {
Expand Down
10 changes: 10 additions & 0 deletions tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ pub struct TripleU16 {
h: u16,
}
#[repr(C)]
pub struct DoubleI32 {
f: i32,
g: i32,
}
#[repr(C)]
pub struct TripleU32 {
f: u32,
g: u32,
Expand Down Expand Up @@ -180,6 +185,11 @@ pub unsafe extern "ptx-kernel" fn f_triple_u8_arg(_a: TripleU8) {}
#[no_mangle]
pub unsafe extern "ptx-kernel" fn f_triple_u16_arg(_a: TripleU16) {}

// CHECK: .visible .entry f_double_i32_arg(
// CHECK: .param .align 4 .b8 f_double_i32_arg_param_0[8]
#[no_mangle]
pub unsafe extern "ptx-kernel" fn f_double_i32_arg(_a: DoubleI32) {}

// CHECK: .visible .entry f_triple_u32_arg(
// CHECK: .param .align 4 .b8 f_triple_u32_arg_param_0[12]
#[no_mangle]
Expand Down

0 comments on commit a49fe0a

Please sign in to comment.