Skip to content

Commit a49fe0a

Browse files
author
Kjetil Kjeka
committed
NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems
1 parent 14348d9 commit a49fe0a

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

tests/assembly/nvptx-c-abi-arg-v7.rs

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ pub struct TripleU16 {
4040
h: u16,
4141
}
4242
#[repr(C)]
43+
pub struct DoubleI32 {
44+
f: i32,
45+
g: i32,
46+
}
47+
#[repr(C)]
4348
pub struct TripleU32 {
4449
f: u32,
4550
g: u32,
@@ -175,6 +180,11 @@ pub unsafe extern "C" fn f_triple_u16_arg(_a: TripleU16) {}
175180
#[no_mangle]
176181
pub unsafe extern "C" fn f_triple_u32_arg(_a: TripleU32) {}
177182

183+
// CHECK: .visible .func f_double_i32_arg(
184+
// CHECK: .param .align 4 .b8 f_double_i32_arg_param_0[8]
185+
#[no_mangle]
186+
pub unsafe extern "C" fn f_double_i32_arg(_a: DoubleI32) {}
187+
178188
// CHECK: .visible .func f_triple_u64_arg(
179189
// CHECK: .param .align 8 .b8 f_triple_u64_arg_param_0[24]
180190
#[no_mangle]

tests/assembly/nvptx-c-abi-ret-v7.rs

+11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ pub struct TripleU16 {
4040
h: u16,
4141
}
4242
#[repr(C)]
43+
pub struct DoubleI32 {
44+
f: i32,
45+
g: i32,
46+
}
47+
#[repr(C)]
4348
pub struct TripleU32 {
4449
f: u32,
4550
g: u32,
@@ -186,6 +191,12 @@ pub unsafe extern "C" fn f_triple_u16_ret() -> TripleU16 {
186191
TripleU16 { f: 18, g: 19, h: 20 }
187192
}
188193

194+
// CHECK: .visible .func (.param .align 4 .b8 func_retval0[8]) f_double_i32_ret(
195+
#[no_mangle]
196+
pub unsafe extern "C" fn f_double_i32_ret() -> DoubleI32 {
197+
DoubleI32 { f: 1, g: 2 }
198+
}
199+
189200
// CHECK: .visible .func (.param .align 4 .b8 func_retval0[12]) f_triple_u32_ret(
190201
#[no_mangle]
191202
pub unsafe extern "C" fn f_triple_u32_ret() -> TripleU32 {

tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs

+10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ pub struct TripleU16 {
5050
h: u16,
5151
}
5252
#[repr(C)]
53+
pub struct DoubleI32 {
54+
f: i32,
55+
g: i32,
56+
}
57+
#[repr(C)]
5358
pub struct TripleU32 {
5459
f: u32,
5560
g: u32,
@@ -180,6 +185,11 @@ pub unsafe extern "ptx-kernel" fn f_triple_u8_arg(_a: TripleU8) {}
180185
#[no_mangle]
181186
pub unsafe extern "ptx-kernel" fn f_triple_u16_arg(_a: TripleU16) {}
182187

188+
// CHECK: .visible .entry f_double_i32_arg(
189+
// CHECK: .param .align 4 .b8 f_double_i32_arg_param_0[8]
190+
#[no_mangle]
191+
pub unsafe extern "ptx-kernel" fn f_double_i32_arg(_a: DoubleI32) {}
192+
183193
// CHECK: .visible .entry f_triple_u32_arg(
184194
// CHECK: .param .align 4 .b8 f_triple_u32_arg_param_0[12]
185195
#[no_mangle]

0 commit comments

Comments
 (0)