Commit 2f98dcf
authored
Rollup merge of rust-lang#131258 - taiki-e:s390x-stabilize-asm, r=Amanieu
Stabilize s390x inline assembly
This stabilizes inline assembly for s390x (SystemZ).
Corresponding reference PR: rust-lang/reference#1643
---
From the requirements of stabilization mentioned in rust-lang#93335
> Each architecture needs to be reviewed before stabilization:
> - It must have clobber_abi.
Done in rust-lang#130630.
> - It must be possible to clobber every register that is normally clobbered by a function call.
Done in the PR that added support for clobber_abi.
> - Generally review that the exposed register classes make sense.
The followings can be used as input/output:
- `reg` (`r[0-10]`, `r[12-14]`): General-purpose register
- `reg_addr` (`r[1-10]`, `r[12-14]`): General-purpose register except `r0` which is evaluated as zero in an address context
This class is needed because `r0`, which may be allocated when using the `reg` class, cannot be used as a register in certain contexts. This is identical to the `a` constraint in LLVM and GCC. See rust-lang#119431 for details.
- `freg` (`f[0-15]`): Floating-point register
The followings are clobber-only:
- `vreg` (`v[0-31]`): Vector register
Technically `vreg` should be able to accept `#[repr(simd)]` types as input/output if the unstable `vector` target feature added is enabled, but `core::arch` has no s390x vector type and both `#[repr(simd)]` and `core::simd` are unstable. Everything related is unstable, so the fact that this is currently a clobber-only should not be considered a stabilization blocker. (rust-lang#130869 tracks unstable stuff here)
- `areg` (`a[2-15]`): Access register
All of the above register classes except `reg_addr` are needed for `clobber_abi`.
The followings cannot be used as operands for inline asm (see also [getReservedRegs](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp#L258-L282) and [SystemZELFRegisters](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.h#L107-L128) in LLVM):
- `r11`: frame pointer
- `r15`: stack pointer
- `a0`, `a1`: Reserved for system use
- `c[0-15]` (control register) Reserved by the kernel
Although not listed in the above requirements, `preserves_flags` is implemented in rust-lang#111331.
---
cc ``@uweigand``
r? ``@Amanieu``
``@rustbot`` label +O-SystemZ +A-inline-assemblyFile tree
4 files changed
+5
-21
lines changed- compiler/rustc_ast_lowering/src
- src/doc/unstable-book/src/language-features
- tests
- assembly/asm
- codegen/asm
4 files changed
+5
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
Lines changed: 2 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
| |||
96 | 90 | | |
97 | 91 | | |
98 | 92 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 93 | | |
104 | 94 | | |
105 | 95 | | |
| |||
159 | 149 | | |
160 | 150 | | |
161 | 151 | | |
162 | | - | |
163 | | - | |
| 152 | + | |
| 153 | + | |
164 | 154 | | |
165 | 155 | | |
166 | 156 | | |
| |||
181 | 171 | | |
182 | 172 | | |
183 | 173 | | |
184 | | - | |
185 | | - | |
186 | 174 | | |
187 | 175 | | |
188 | 176 | | |
| |||
206 | 194 | | |
207 | 195 | | |
208 | 196 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | 197 | | |
213 | 198 | | |
214 | 199 | | |
| |||
232 | 217 | | |
233 | 218 | | |
234 | 219 | | |
235 | | - | |
236 | | - | |
237 | 220 | | |
238 | 221 | | |
239 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
0 commit comments