mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
test u128 passing on linux and windows
This commit is contained in:
@@ -1273,8 +1273,11 @@ fn codegen_call_terminator(
|
||||
op.val = Ref(arg.val);
|
||||
}
|
||||
LocalRef::Operand(arg) => {
|
||||
let Ref(place_value) = arg.val else {
|
||||
bug!("only `Ref` should use `PassMode::Indirect`");
|
||||
};
|
||||
bx.typed_place_copy(
|
||||
arg.val.deref(fn_abi.args[i].layout.align.abi),
|
||||
place_value,
|
||||
tmp.val,
|
||||
fn_abi.args[i].layout,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//@ add-minicore
|
||||
//@ min-llvm-version: 22
|
||||
//@ assembly-output: emit-asm
|
||||
//@ needs-llvm-components: x86
|
||||
//@ compile-flags: --target=x86_64-unknown-linux-gnu
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//@ add-minicore
|
||||
//@ revisions: win linux
|
||||
//@ min-llvm-version: 22
|
||||
//
|
||||
//@ compile-flags: -Copt-level=3
|
||||
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
|
||||
//@[linux] needs-llvm-components: x86
|
||||
//@[win] compile-flags: --target x86_64-pc-windows-msvc
|
||||
//@[win] needs-llvm-components: x86
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(no_core, lang_items, explicit_tail_calls)]
|
||||
#![allow(incomplete_features)]
|
||||
#![no_core]
|
||||
|
||||
// Test passing of i128/u128, which is passed directly on x86, but indirectly on win64.
|
||||
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
// linux: define noundef i128 @foo(i128 noundef %a, i128 noundef %b)
|
||||
// win: define <16 x i8> @foo(ptr {{.*}} %a, ptr {{.*}} %b)
|
||||
#[unsafe(no_mangle)]
|
||||
#[inline(never)]
|
||||
extern "C" fn foo(a: u128, b: u128) -> u128 {
|
||||
// linux: start:
|
||||
// linux-NEXT: musttail call noundef i128 @bar(i128 noundef %b, i128 noundef %a)
|
||||
//
|
||||
//
|
||||
// win: start:
|
||||
// win-NEXT: %0 = load i128, ptr %b
|
||||
// win-NEXT: %1 = load i128, ptr %a
|
||||
// win-NEXT: store i128 %0, ptr %a
|
||||
// win-NEXT: store i128 %1, ptr %b
|
||||
// win-NEXT: musttail call <16 x i8> @bar(ptr {{.*}} %a, ptr {{.*}} %b)
|
||||
become bar(b, a)
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
safe fn bar(a: u128, b: u128) -> u128;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
//@ run-pass
|
||||
//@ ignore-backends: gcc
|
||||
//
|
||||
//@ ignore-wasm
|
||||
//@ ignore-riscv64
|
||||
#![feature(explicit_tail_calls)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user