Skip to content

Commit eeb0b52

Browse files
committed
Feat: further testing & support for i64 general register use
1 parent 66e95b1 commit eeb0b52

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed

compiler/rustc_target/src/asm/s390x.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl S390xInlineAsmRegClass {
3535
arch: InlineAsmArch,
3636
) -> &'static [(InlineAsmType, Option<&'static str>)] {
3737
match (self, arch) {
38-
(Self::reg, _) => types! { _: I8, I16, I32; },
38+
(Self::reg, _) => types! { _: I8, I16, I32, I64; },
3939
(Self::freg, _) => types! { _: F32, F64; },
4040
}
4141
}

src/test/assembly/asm/s390x-types.rs

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
6060
};}
6161

6262
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
63-
63+
#[no_mangle]
6464
pub unsafe fn $func(x: $ty) -> $ty {
6565
dont_merge(stringify!(func));
6666

@@ -70,17 +70,57 @@ macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
7070
}
7171
};}
7272

73-
// systemz-LABEL: sym_fn_32:
74-
// systemz: #APP
75-
// systemz: brasl %r14, extern_func@PLT
76-
// systemz: #NO_APP
73+
// CHECK-LABEL: sym_fn_32:
74+
// CHECK: #APP
75+
// CHECK: brasl %r14, extern_func
76+
// CHECK: #NO_APP
7777
#[cfg(s390x)]
78+
#[no_mangle]
7879
pub unsafe fn sym_fn_32() {
7980
asm!("brasl %r14, {}", sym extern_func);
8081
}
8182

83+
// CHECK-LABEL: sym_static:
84+
// CHECK: #APP
85+
// CHECK: brasl %r14, extern_static
86+
// CHECK: #NO_APP
87+
#[no_mangle]
88+
pub unsafe fn sym_static() {
89+
asm!("brasl %r14, {}", sym extern_static);
90+
}
91+
92+
// CHECK-LABEL: reg_i8:
93+
// CHECK: #APP
94+
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
95+
// CHECK: #NO_APP
96+
check!(reg_i8, i8, reg, "lgr");
97+
98+
// CHECK-LABEL: reg_i16:
99+
// CHECK: #APP
100+
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
101+
// CHECK: #NO_APP
102+
check!(reg_i16, i16, reg, "lgr");
103+
82104
// CHECK-LABEL: reg_i32:
83105
// CHECK: #APP
84-
// CHECK: lgr r{{[0-15]+}}, r{{[0-15]+}}
106+
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
85107
// CHECK: #NO_APP
86108
check!(reg_i32, i32, reg, "lgr");
109+
110+
// CHECK-LABEL: reg_i64:
111+
// CHECK: #APP
112+
// CHECK: lgr %r{{[0-9]+}}, %r{{[0-9]+}}
113+
// CHECK: #NO_APP
114+
check!(reg_i64, i64, reg, "lgr");
115+
116+
// CHECK-LABEL: reg_f32:
117+
// CHECK: #APP
118+
// CHECK: ler %f{{[0-9]+}}, %f{{[0-9]+}}
119+
// CHECK: #NO_APP
120+
check!(reg_f32, f32, freg, "ler");
121+
122+
// CHECK-LABEL: reg_f64:
123+
// CHECK: #APP
124+
// CHECK: ldr %f{{[0-9]+}}, %f{{[0-9]+}}
125+
// CHECK: #NO_APP
126+
check!(reg_f64, f64, freg, "ldr");

0 commit comments

Comments
 (0)