rust/tests/assembly
Jubilee 2f98dcf9ba
Rollup merge of #131258 - taiki-e:s390x-stabilize-asm, r=Amanieu
Stabilize s390x inline assembly

This stabilizes inline assembly for s390x (SystemZ).

Corresponding reference PR: https://github.com/rust-lang/reference/pull/1643

---

From the requirements of stabilization mentioned in https://github.com/rust-lang/rust/issues/93335

> Each architecture needs to be reviewed before stabilization:

> - It must have clobber_abi.

Done in https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/pull/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. (https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/111331.

---

cc ``@uweigand``

r? ``@Amanieu``

``@rustbot`` label +O-SystemZ +A-inline-assembly
2024-11-09 20:28:43 -08:00
..
asm Stabilize s390x inline assembly 2024-11-08 10:46:00 +09:00
auxiliary
compiletest-self-test tests/assembly: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
libs
nvptx-kernel-abi
simd
stack-protector Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
targets Remove the wasm32-wasi target from rustc 2024-11-03 07:09:34 -08:00
aarch64-naked-fn-no-bti-prolog.rs more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
aarch64-pointer-auth.rs rustc_codegen_llvm: Add a new 'pc' option to branch-protection 2024-10-31 11:59:17 +00:00
align_offset.rs
closure-inherit-target-feature.rs
cmse.rs Improve assembly test for CMSE ABIs 2024-09-23 18:57:38 +02:00
dwarf4.rs
dwarf5.rs
is_aligned.rs
issue-83585-small-pod-struct-equality.rs
manual-eq-efficient.rs
niche-prefer-zero.rs
nvptx-arch-default.rs
nvptx-arch-emit-asm.rs
nvptx-arch-link-arg.rs
nvptx-arch-target-cpu.rs
nvptx-atomics.rs
nvptx-c-abi-arg-v7.rs
nvptx-c-abi-ret-v7.rs
nvptx-internalizing.rs
nvptx-linking-binary.rs
nvptx-linking-cdylib.rs
nvptx-safe-naming.rs
panic-no-unwind-no-uwtable.rs
panic-unwind-no-uwtable.rs
pic-relocation-model.rs
pie-relocation-model.rs
powerpc64-struct-abi.rs add aix aggregate test 2024-10-07 20:40:55 -04:00
riscv-soft-abi-with-float-features.rs riscv-soft-abi-with-float-features.rs: adapt for LLVM 20 2024-10-28 13:43:03 +00:00
rust-abi-arg-attr.rs remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
s390x-backchain-toggle.rs
simd-bitmask.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-gather.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-mask-load.rs
simd-intrinsic-mask-reduce.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-mask-store.rs
simd-intrinsic-scatter.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
simd-intrinsic-select.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
slice-is_ascii.rs
small_data_threshold.rs
sparc-struct-abi.rs
stack-probes.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
static-relocation-model.rs
strict_provenance.rs
target-feature-multiple.rs
wasm_exceptions.rs
x86_64-array-pair-load-store-merge.rs
x86_64-cmp.rs
x86_64-floating-point-clamp.rs
x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs
x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs
x86_64-function-return.rs
x86_64-naked-fn-no-cet-prolog.rs more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
x86_64-no-jump-tables.rs
x86_64-sse_crc.rs
x86_64-typed-swap.rs
x86_64-windows-float-abi.rs
x86-return-float.rs adjust asm test 2024-10-22 12:21:00 +01:00