2024-02-22 06:10:29 -06:00
|
|
|
//@ compile-flags: -O
|
|
|
|
//@ only-x86_64
|
2023-08-23 07:57:18 -05:00
|
|
|
|
|
|
|
#![crate_type = "rlib"]
|
|
|
|
#![allow(asm_sub_register)]
|
|
|
|
|
|
|
|
use std::arch::asm;
|
2024-05-28 23:11:20 -05:00
|
|
|
use std::mem::MaybeUninit;
|
2023-08-23 07:57:18 -05:00
|
|
|
|
|
|
|
// CHECK-LABEL: @int
|
|
|
|
#[no_mangle]
|
|
|
|
pub unsafe fn int(x: MaybeUninit<i32>) -> MaybeUninit<i32> {
|
|
|
|
let y: MaybeUninit<i32>;
|
|
|
|
asm!("/*{}{}*/", in(reg) x, out(reg) y);
|
|
|
|
y
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @inout
|
|
|
|
#[no_mangle]
|
|
|
|
pub unsafe fn inout(mut x: i32) -> MaybeUninit<u32> {
|
|
|
|
let mut y: MaybeUninit<u32>;
|
|
|
|
asm!("/*{}*/", inout(reg) x => y);
|
|
|
|
asm!("/*{}*/", inout(reg) y => x);
|
|
|
|
asm!("/*{}*/", inlateout(reg) x => y);
|
|
|
|
asm!("/*{}*/", inlateout(reg) y => x);
|
|
|
|
y
|
|
|
|
}
|