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 Move /src/test to /tests 2023-01-11 09:32:08 +00:00
compiletest-self-test tests/assembly: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
libs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-kernel-abi NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
simd Ignore reduce-fadd-unordered on SGX platform 2024-09-16 16:54:48 +02:00
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 Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
closure-inherit-target-feature.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
cmse.rs Improve assembly test for CMSE ABIs 2024-09-23 18:57:38 +02:00
dwarf4.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dwarf5.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
is_aligned.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
issue-83585-small-pod-struct-equality.rs Fix tests for 32 bits targets 2024-06-11 07:45:16 +00:00
manual-eq-efficient.rs Add test for efficient codegen of manual eq implementations of a small struct 2024-04-30 13:21:08 +00:00
niche-prefer-zero.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-default.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-emit-asm.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-link-arg.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-target-cpu.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-atomics.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-c-abi-arg-v7.rs NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
nvptx-c-abi-ret-v7.rs NVPTX:_Especially add the DoubleI32 struct as a nvptx abi test case since it was used as an example when discussing possible problems 2024-05-31 23:12:33 +02:00
nvptx-internalizing.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-binary.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-cdylib.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-safe-naming.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
panic-no-unwind-no-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
panic-unwind-no-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pic-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
pie-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
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 tests: add an assembly scanning test for s390x backchain switch 2024-09-04 08:10:53 -06:00
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 Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
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 Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
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 Ignore less tests in debug builds 2024-02-23 18:04:01 -05:00
small_data_threshold.rs small_data_threshold.rs: Adapt to LLVM head changes 2024-09-12 09:53:59 +02:00
sparc-struct-abi.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
stack-probes.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
static-relocation-model.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
strict_provenance.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
target-feature-multiple.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
wasm_exceptions.rs Fix wasm_exceptions test 2024-06-19 21:26:48 +01:00
x86_64-array-pair-load-store-merge.rs Make more of the test suite run on Mac Catalyst 2024-05-28 12:31:33 +02:00
x86_64-cmp.rs llvm 20: adapt integer comparison tests 2024-08-22 13:23:00 +00:00
x86_64-floating-point-clamp.rs Add inline comments why we're forcing the target cpu 2024-05-01 16:54:20 -07:00
x86_64-fortanix-unknown-sgx-lvi-generic-load.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-function-return.rs Make more of the test suite run on Mac Catalyst 2024-05-28 12:31:33 +02:00
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 [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-sse_crc.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-typed-swap.rs Avoid non-windows non-linux in assembly x64 test 2024-03-23 00:02:53 -07:00
x86_64-windows-float-abi.rs Match LLVM ABI in extern "C" functions for f128 on Windows 2024-07-30 20:23:33 +01:00
x86-return-float.rs adjust asm test 2024-10-22 12:21:00 +01:00