Skip to content

Commit 1c1c13a

Browse files
committed
Restore previous ABI for f_single_u8_arg
1 parent 062bc02 commit 1c1c13a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler/rustc_target/src/callconv/nvptx64.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ where
7575
16 => Reg::i128(),
7676
_ => unreachable!("Align is given as power of 2 no larger than 16 bytes"),
7777
};
78-
arg.cast_to(Uniform::new(unit, arg.layout.size));
78+
if arg.layout.size.bytes() / align_bytes == 1 {
79+
// Make sure we pass the struct as array at the LLVM IR level and not as a single integer.
80+
arg.cast_to(CastTarget {
81+
prefix: [Some(unit), None, None, None, None, None, None, None],
82+
rest: Uniform::new(unit, Size::ZERO),
83+
attrs: ArgAttributes::new(),
84+
});
85+
} else {
86+
arg.cast_to(Uniform::new(unit, arg.layout.size));
87+
}
7988
}
8089

8190
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub unsafe extern "ptx-kernel" fn f_f32_arg(_a: f32) {}
166166
pub unsafe extern "ptx-kernel" fn f_f64_arg(_a: f64) {}
167167

168168
// CHECK: .visible .entry f_single_u8_arg(
169-
// CHECK: .param .u8 f_single_u8_arg_param_0
169+
// CHECK: .param .align 1 .b8 f_single_u8_arg_param_0[1]
170170
#[no_mangle]
171171
pub unsafe extern "ptx-kernel" fn f_single_u8_arg(_a: SingleU8) {}
172172

0 commit comments

Comments
 (0)