Stabilize s390x vector target feature and is_s390x_feature_detected! macro by folkertdev · Pull Request #145656 · rust-lang/rust (original) (raw)
closes #145649
closes #135413
cc: #130869
reference PR: rust-lang/reference#1972
Stabilization report
Summary
This PR stabilizes the following s390x target features:
vectorvector-enhancements-1vector-enhancements-2vector-enhancements-3vector-packed-decimalvector-packed-decimal-enhancementvector-packed-decimal-enhancement-2vector-packed-decimal-enhancement-3nnp-assistmiscellaneous-extensions-2miscellaneous-extensions-3miscellaneous-extensions-4
Additionally, it stabilizes the std::arch::is_s390x_feature_detected! macro itself and stably accepts the target features listed above.
Tests & ABI details
Only the vector target feature changes the ABI, much like e.g. avx2 it will, depending on the ABI, pass vector types in vector registers. This behavior is tested extensively:
- tests/assembly-llvm/s390x-vector-abi.rs
- tests/codegen-llvm/s390x-simd.rs
- tests/ui/abi/simd-abi-checks-s390x.rs
The remaining features don't influence the ABI, they only influence instruction selection. In stdarch we test that the expected instructions are in fact generated when the target feature is enabled.
Implementation history
For is_s390x_feature_detected!:
- add is_s390x_feature_detected stdarch#1699
- expose is_s390x_feature_detected! from std::arch #138275
- s390x_is_feature_detected!: detect more features stdarch#1720
- s390x: z17 target feature detection stdarch#1832
For vector and friends
- rustc_target: add known safe s390x target features #127506
- add more s390x target features #135630
- add s390x z17 target features #141250
Unresolved questions
There is a fixme in tests/ui/abi/simd-abi-checks-s390x.rs:
// FIXME: +soft-float itself doesn't set -vector
//@[z13_soft_float] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector,+soft-float
//@[z13_soft_float] needs-llvm-components: systemz
I'm not sure whether that blocks stabilization?
The implementation first extracts the listed target features into their own s390x_target_feature_vector rust feature, and then stabilizes that. best reviewed commit-by-commit