Skip to content

Commit 69c7e1d

Browse files
committed
add more s390x target features
The target feature names are, right now, based on the llvm target feature names. These mostly line up well with the names of [Facility Inidications](https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf#page=301) names. The linux kernel uses shorter, more cryptic names. (e.g. "vector" is `vx`). We can deviate from the llvm names, but the CPU vendor (IBM) does not appear to use e.g. `vx` for what they call `vector`. There are a number of implied target features between the vector facilities (based on the [Facility Inidications](https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf#page=301) table): - 129 The vector facility for z/Architecture is installed in the z/Architecture architectural mode. - 134 The vector packed decimal facility is installed in the z/Architecture architectural mode. When bit 134 is one, bit 129 is also one. - 135 The vector enhancements facility 1 is installed in the z/Architecture architectural mode. When bit 135 is one, bit 129 is also one. - 148 The vector-enhancements facility 2 is installed in the z/Architecture architectural mode. When bit 148 is one, bits 129 and 135 are also one. - 152 The vector-packed-decimal-enhancement facility 1 is installed in the z/Architecture architectural mode. When bit 152 is one, bits 129 and 134 are also one. - 165 The neural-network-processing-assist facility is installed in the z/Architecture architectural mode. When bit 165 is one, bit 129 is also one. - 192 The vector-packed-decimal-enhancement facility 2 is installed in the z/Architecture architectural mode. When bit 192 is one, bits 129, 134, and 152 are also one. And then there are a number of facilities without any implied target features - 45 The distinct-operands, fast-BCR-serialization, high-word, and population-count facilities, the interlocked-access facility 1, and the load/store-oncondition facility 1 are installed in the z/Architecture architectural mode. - 73 The transactional-execution facility is installed in the z/Architecture architectural mode. Bit 49 is one when bit 73 is one. - 133 The guarded-storage facility is installed in the z/Architecture architectural mode. - 150 The enhanced-sort facility is installed in the z/Architecture architectural mode. - 151 The DEFLATE-conversion facility is installed in the z/Architecture architectural mode. The added target features are those that have ISA implications, can be queried at runtime, and have LLVM support. LLVM [defines more target features](https://github.com/llvm/llvm-project/blob/d49a2d2bc9c65c787bfa04ac8ece614da48a8cd5/llvm/lib/Target/SystemZ/SystemZFeatures.td), but I'm not sure those are useful. They can always be added later, and can already be set globally using `-Ctarget-feature`.
1 parent f04bbc6 commit 69c7e1d

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

Diff for: compiler/rustc_target/src/target_features.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,26 @@ static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
611611
const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
612612
// tidy-alphabetical-start
613613
("backchain", Unstable(sym::s390x_target_feature), &[]),
614+
("deflate-conversion", Unstable(sym::s390x_target_feature), &[]),
615+
("enhanced-sort", Unstable(sym::s390x_target_feature), &[]),
616+
("guarded-storage", Unstable(sym::s390x_target_feature), &[]),
617+
("high-word", Unstable(sym::s390x_target_feature), &[]),
618+
("nnp-assist", Unstable(sym::s390x_target_feature), &["vector"]),
619+
("transactional-execution", Unstable(sym::s390x_target_feature), &[]),
614620
("vector", Unstable(sym::s390x_target_feature), &[]),
621+
("vector-enhancements-1", Unstable(sym::s390x_target_feature), &["vector"]),
622+
("vector-enhancements-2", Unstable(sym::s390x_target_feature), &["vector-enhancements-1"]),
623+
("vector-packed-decimal", Unstable(sym::s390x_target_feature), &["vector"]),
624+
(
625+
"vector-packed-decimal-enhancement",
626+
Unstable(sym::s390x_target_feature),
627+
&["vector-packed-decimal"],
628+
),
629+
(
630+
"vector-packed-decimal-enhancement-2",
631+
Unstable(sym::s390x_target_feature),
632+
&["vector-packed-decimal-enhancement"],
633+
),
615634
// tidy-alphabetical-end
616635
];
617636

@@ -768,7 +787,7 @@ impl Target {
768787
/// the first list contains target features that must be enabled for ABI reasons,
769788
/// and the second list contains target feature that must be disabled for ABI reasons.
770789
///
771-
/// These features are automatically appended to whatever the target spec sats as default
790+
/// These features are automatically appended to whatever the target spec sets as default
772791
/// features for the target.
773792
///
774793
/// All features enabled/disabled via `-Ctarget-features` and `#[target_features]` are checked

Diff for: tests/ui/check-cfg/target_feature.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
5858
`cssc`
5959
`d`
6060
`d32`
61+
`deflate-conversion`
6162
`dit`
6263
`doloop`
6364
`dotprod`
@@ -72,6 +73,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
7273
`ecv`
7374
`edsp`
7475
`elrw`
76+
`enhanced-sort`
7577
`ermsb`
7678
`exception-handling`
7779
`extended-const`
@@ -109,11 +111,13 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
109111
`frintts`
110112
`fxsr`
111113
`gfni`
114+
`guarded-storage`
112115
`hard-float`
113116
`hard-float-abi`
114117
`hard-tp`
115118
`hbc`
116119
`high-registers`
120+
`high-word`
117121
`hvx`
118122
`hvx-length128b`
119123
`hwdiv`
@@ -151,6 +155,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
151155
`multivalue`
152156
`mutable-globals`
153157
`neon`
158+
`nnp-assist`
154159
`nontrapping-fptoint`
155160
`nvic`
156161
`paca`
@@ -229,6 +234,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
229234
`thumb-mode`
230235
`thumb2`
231236
`tme`
237+
`transactional-execution`
232238
`trust`
233239
`trustzone`
234240
`ual`
@@ -262,6 +268,11 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
262268
`vdspv1`
263269
`vdspv2`
264270
`vector`
271+
`vector-enhancements-1`
272+
`vector-enhancements-2`
273+
`vector-packed-decimal`
274+
`vector-packed-decimal-enhancement`
275+
`vector-packed-decimal-enhancement-2`
265276
`vfp2`
266277
`vfp3`
267278
`vfp4`

0 commit comments

Comments
 (0)