test u128 passing on linux and windows

This commit is contained in:
Folkert de Vries
2026-01-17 14:30:01 +01:00
parent 31ae3d2be8
commit e6cf5a22e7
4 changed files with 49 additions and 1 deletions
+4 -1
View File
@@ -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
+41
View File
@@ -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;
}
+3
View File
@@ -1,5 +1,8 @@
//@ run-pass
//@ ignore-backends: gcc
//
//@ ignore-wasm
//@ ignore-riscv64
#![feature(explicit_tail_calls)]
#![expect(incomplete_features)]