Feat: further testing & support for i64 general register use

This commit is contained in:
linux1 2021-08-22 17:26:18 -04:00
parent 66e95b17ec
commit eeb0b52bf8
2 changed files with 47 additions and 7 deletions

View file

@ -35,7 +35,7 @@ impl S390xInlineAsmRegClass {
arch: InlineAsmArch, arch: InlineAsmArch,
) -> &'static [(InlineAsmType, Option<&'static str>)] { ) -> &'static [(InlineAsmType, Option<&'static str>)] {
match (self, arch) { match (self, arch) {
(Self::reg, _) => types! { _: I8, I16, I32; }, (Self::reg, _) => types! { _: I8, I16, I32, I64; },
(Self::freg, _) => types! { _: F32, F64; }, (Self::freg, _) => types! { _: F32, F64; },
} }
} }

View file

@ -60,7 +60,7 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
};} };}
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => { macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty { pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!(func)); dont_merge(stringify!(func));
@ -70,17 +70,57 @@ macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
} }
};} };}
// systemz-LABEL: sym_fn_32: // CHECK-LABEL: sym_fn_32:
// systemz: #APP // CHECK: #APP
// systemz: brasl %r14, extern_func@PLT // CHECK: brasl %r14, extern_func
// systemz: #NO_APP // CHECK: #NO_APP
#[cfg(s390x)] #[cfg(s390x)]
#[no_mangle]
pub unsafe fn sym_fn_32() { pub unsafe fn sym_fn_32() {
asm!("brasl %r14, {}", sym extern_func); asm!("brasl %r14, {}", sym extern_func);
} }
// CHECK-LABEL: sym_static:
// CHECK: #APP
// CHECK: brasl %r14, extern_static
// CHECK: #NO_APP
#[no_mangle]
pub unsafe fn sym_static() {
asm!("brasl %r14, {}", sym extern_static);
}
// CHECK-LABEL: reg_i8:
// CHECK: #APP
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
// CHECK: #NO_APP
check!(reg_i8, i8, reg, "lgr");
// CHECK-LABEL: reg_i16:
// CHECK: #APP
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
// CHECK: #NO_APP
check!(reg_i16, i16, reg, "lgr");
// CHECK-LABEL: reg_i32: // CHECK-LABEL: reg_i32:
// CHECK: #APP // CHECK: #APP
// CHECK: lgr r{{[0-15]+}}, r{{[0-15]+}} // CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
// CHECK: #NO_APP // CHECK: #NO_APP
check!(reg_i32, i32, reg, "lgr"); check!(reg_i32, i32, reg, "lgr");
// CHECK-LABEL: reg_i64:
// CHECK: #APP
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
// CHECK: #NO_APP
check!(reg_i64, i64, reg, "lgr");
// CHECK-LABEL: reg_f32:
// CHECK: #APP
// CHECK: ler %f{{[0-9]+}}, %f{{[0-9]+}}
// CHECK: #NO_APP
check!(reg_f32, f32, freg, "ler");
// CHECK-LABEL: reg_f64:
// CHECK: #APP
// CHECK: ldr %f{{[0-9]+}}, %f{{[0-9]+}}
// CHECK: #NO_APP
check!(reg_f64, f64, freg, "ldr");