Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #125663

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ead02ba
NVPTX: Avoid PassMode::Direct for args in C abi
May 10, 2024
f63931b
Cleanup custom mingw in CI
ChrisDenton May 26, 2024
19cfe8d
Add "Setup Python" action to github-hosted runners
ChrisDenton May 26, 2024
ede62b8
Add an intrinsic for `ptr::metadata`
scottmcm Apr 21, 2024
ce8f37b
Add custom mir support for `PtrMetadata`
scottmcm May 25, 2024
0f9e4d6
Add Miri tests for `PtrMetadata` UB
scottmcm May 26, 2024
f931290
Update description of install-mingw
ChrisDenton May 27, 2024
713ddc2
Add Miri smoke pass test for ptr_metadata intrinsic
scottmcm May 27, 2024
bcfa67d
Remove out-of-date comment.
nnethercote May 22, 2024
5673337
Add `assert_not_contains` to `run-make-support` library
GuillaumeGomez May 27, 2024
404d47e
Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`
GuillaumeGomez May 26, 2024
4702a1c
Fix comments.
nnethercote May 28, 2024
f1b0ca0
Don't format `tests/run-make/*/rmake.rs`.
nnethercote May 28, 2024
50a5da1
EvalCtxt::tcx() -> EvalCtxt::interner()
compiler-errors May 19, 2024
f494036
Make ProofTreeBuilder actually generic over interner
compiler-errors May 19, 2024
2c5a26b
Rollup merge of #117671 - kjetilkjeka:nvptx_c_abi_avoid_direct, r=dav…
matthiaskrgr May 28, 2024
f96ce48
Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
matthiaskrgr May 28, 2024
df3b962
Rollup merge of #125573 - GuillaumeGomez:migrate-allow-warnings-cmdli…
matthiaskrgr May 28, 2024
1c51557
Rollup merge of #125590 - ChrisDenton:mingw-ci-3, r=Kobzol
matthiaskrgr May 28, 2024
87cd582
Rollup merge of #125598 - compiler-errors:proof-tree-builder, r=lcnr
matthiaskrgr May 28, 2024
2c7d9ce
Rollup merge of #125637 - nnethercote:rustfmt-fixes, r=GuillaumeGomez
matthiaskrgr May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
NVPTX: Avoid PassMode::Direct for args in C abi
  • Loading branch information
Kjetil Kjeka committed May 10, 2024
commit ead02ba0f14f8d54c3c05d8382d317d9b320072a
9 changes: 4 additions & 5 deletions compiler/rustc_target/src/abi/call/nvptx64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
}

fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
if arg.layout.is_aggregate() && arg.layout.size.bits() > 64 {
arg.make_indirect();
} else {
// FIXME: this is wrong! Need to decide which ABI we really want here.
arg.make_direct_deprecated();
if arg.layout.is_aggregate() {
arg.make_indirect_byval(None);
} else if arg.layout.size.bits() < 32 {
arg.extend_integer_width_to(32);
}
}

Expand Down
206 changes: 206 additions & 0 deletions tests/assembly/nvptx-c-abi-arg-v7.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
//@ assembly-output: ptx-linker
//@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 -Z unstable-options -Clinker-flavor=llbc
//@ only-nvptx64

// The PTX ABI stability is tied to major versions of the PTX ISA
// These tests assume major version 7

// CHECK: .version 7

#![feature(abi_ptx, lang_items, no_core)]
#![no_core]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

#[repr(C)]
pub struct SingleU8 {
f: u8,
}

#[repr(C)]
pub struct DoubleU8 {
f: u8,
g: u8,
}

#[repr(C)]
pub struct TripleU8 {
f: u8,
g: u8,
h: u8,
}

#[repr(C)]
pub struct TripleU16 {
f: u16,
g: u16,
h: u16,
}
#[repr(C)]
pub struct TripleU32 {
f: u32,
g: u32,
h: u32,
}
#[repr(C)]
pub struct TripleU64 {
f: u64,
g: u64,
h: u64,
}

#[repr(C)]
pub struct DoubleFloat {
f: f32,
g: f32,
}

#[repr(C)]
pub struct TripleFloat {
f: f32,
g: f32,
h: f32,
}

#[repr(C)]
pub struct TripleDouble {
f: f64,
g: f64,
h: f64,
}

#[repr(C)]
pub struct ManyIntegers {
f: u8,
g: u16,
h: u32,
i: u64,
}

#[repr(C)]
pub struct ManyNumerics {
f: u8,
g: u16,
h: u32,
i: u64,
j: f32,
k: f64,
}

// CHECK: .visible .func f_u8_arg(
// CHECK: .param .b32 f_u8_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_u8_arg(_a: u8) {}

// CHECK: .visible .func f_u16_arg(
// CHECK: .param .b32 f_u16_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_u16_arg(_a: u16) {}

// CHECK: .visible .func f_u32_arg(
// CHECK: .param .b32 f_u32_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_u32_arg(_a: u32) {}

// CHECK: .visible .func f_u64_arg(
// CHECK: .param .b64 f_u64_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_u64_arg(_a: u64) {}

// CHECK: .visible .func f_u128_arg(
// CHECK: .param .align 16 .b8 f_u128_arg_param_0[16]
#[no_mangle]
pub unsafe extern "C" fn f_u128_arg(_a: u128) {}

// CHECK: .visible .func f_i8_arg(
// CHECK: .param .b32 f_i8_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_i8_arg(_a: i8) {}

// CHECK: .visible .func f_i16_arg(
// CHECK: .param .b32 f_i16_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_i16_arg(_a: i16) {}

// CHECK: .visible .func f_i32_arg(
// CHECK: .param .b32 f_i32_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_i32_arg(_a: i32) {}

// CHECK: .visible .func f_i64_arg(
// CHECK: .param .b64 f_i64_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_i64_arg(_a: i64) {}

// CHECK: .visible .func f_i128_arg(
// CHECK: .param .align 16 .b8 f_i128_arg_param_0[16]
#[no_mangle]
pub unsafe extern "C" fn f_i128_arg(_a: i128) {}

// CHECK: .visible .func f_f32_arg(
// CHECK: .param .b32 f_f32_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_f32_arg(_a: f32) {}

// CHECK: .visible .func f_f64_arg(
// CHECK: .param .b64 f_f64_arg_param_0
#[no_mangle]
pub unsafe extern "C" fn f_f64_arg(_a: f64) {}

// CHECK: .visible .func f_single_u8_arg(
// CHECK: .param .align 1 .b8 f_single_u8_arg_param_0[1]
#[no_mangle]
pub unsafe extern "C" fn f_single_u8_arg(_a: SingleU8) {}

// CHECK: .visible .func f_double_u8_arg(
// CHECK: .param .align 1 .b8 f_double_u8_arg_param_0[2]
#[no_mangle]
pub unsafe extern "C" fn f_double_u8_arg(_a: DoubleU8) {}

// CHECK: .visible .func f_triple_u8_arg(
// CHECK: .param .align 1 .b8 f_triple_u8_arg_param_0[3]
#[no_mangle]
pub unsafe extern "C" fn f_triple_u8_arg(_a: TripleU8) {}

// CHECK: .visible .func f_triple_u16_arg(
// CHECK: .param .align 2 .b8 f_triple_u16_arg_param_0[6]
#[no_mangle]
pub unsafe extern "C" fn f_triple_u16_arg(_a: TripleU16) {}

// CHECK: .visible .func f_triple_u32_arg(
// CHECK: .param .align 4 .b8 f_triple_u32_arg_param_0[12]
#[no_mangle]
pub unsafe extern "C" fn f_triple_u32_arg(_a: TripleU32) {}

// CHECK: .visible .func f_triple_u64_arg(
// CHECK: .param .align 8 .b8 f_triple_u64_arg_param_0[24]
#[no_mangle]
pub unsafe extern "C" fn f_triple_u64_arg(_a: TripleU64) {}

// CHECK: .visible .func f_many_integers_arg(
// CHECK: .param .align 8 .b8 f_many_integers_arg_param_0[16]
#[no_mangle]
pub unsafe extern "C" fn f_many_integers_arg(_a: ManyIntegers) {}

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

// CHECK: .visible .func f_triple_float_arg(
// CHECK: .param .align 4 .b8 f_triple_float_arg_param_0[12]
#[no_mangle]
pub unsafe extern "C" fn f_triple_float_arg(_a: TripleFloat) {}

// CHECK: .visible .func f_triple_double_arg(
// CHECK: .param .align 8 .b8 f_triple_double_arg_param_0[24]
#[no_mangle]
pub unsafe extern "C" fn f_triple_double_arg(_a: TripleDouble) {}

// CHECK: .visible .func f_many_numerics_arg(
// CHECK: .param .align 8 .b8 f_many_numerics_arg_param_0[32]
#[no_mangle]
pub unsafe extern "C" fn f_many_numerics_arg(_a: ManyNumerics) {}
Loading
Loading