Skip to content

add s390x z17 target features #141250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025

Conversation

folkertdev
Copy link
Contributor

tracking issue: #130869

earlier target features were added in #135630, and #135413 (comment) has some extra context on these new features.

r? @ghost
cc @uweigand

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 19, 2025
@rust-log-analyzer

This comment has been minimized.

@folkertdev
Copy link
Contributor Author

Based on that CI log, I believe what is happening is that rust still supportes LLVM 19 (because of linux distributions), and in that version these new target features are not yet present. So, we may need to wait until the lowest supported LLVM version also does support these target features.

@uweigand
Copy link
Contributor

Hi @folkertdev , I've checked the implications against the official docs, and the following are not quite correct:

  • there is not any implicit link between the different miscellaneous-extensions features
  • only the following implicit links between message-security-assist features exist: MSA8 -> MSA3; MSA9 -> MSA3 & MSA4 ; MSA12 -> MSA6 (but we don't have a MSA6 feature since it doesn't introduce new ISA)
  • the MSA7 feature has no HWCAP or STFLE feature bit as it does not provide actual new ISA - it is only an LLVM feature because it provides an additional assembler mnemonic to an already existing instruction

Checking for completeness, for recent processors, the only missing features now are related to privileged (kernel-only) instructions:

  "bear-enhancement" - bit 193
  "reset-dat-protection" - bit 194
  "processor-activity-instrumentation" - bit 196
  "insert-reference-bits-multiple" - bit 145
  "test-pending-external-interruption" - bit 144

It seems OK to omit those (at least until such time as core kernel components may be written in Rust ...).

Every other LLVM feature that is still missing is about rather old processor versions (z13 and older) - at this point in time it's no longer useful to write code distinguishing pre-z13 features, those old machines are barely in use any more (if at all).

Overall, I think with the implicit feature links fixed as described above, this should be good to do. Thanks!

@folkertdev folkertdev force-pushed the s390x-z17-target-features branch from 67cb97c to 6bf41a5 Compare May 19, 2025 14:40
@taiki-e
Copy link
Member

taiki-e commented May 19, 2025

Based on that CI log, I believe what is happening is that rust still supportes LLVM 19 (because of linux distributions), and in that version these new target features are not yet present. So, we may need to wait until the lowest supported LLVM version also does support these target features.

Target features not available in older LLVM can be handled in to_llvm_features function in rustc_codegen_llvm/src/llvm_util.rs like some riscv features do:

// Filter out features that are not supported by the current LLVM version
("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,

@folkertdev folkertdev force-pushed the s390x-z17-target-features branch from 6bf41a5 to 1d50046 Compare May 19, 2025 14:52
Copy link
Contributor

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM now from a SystemZ target perspective. Thanks!

@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the s390x-z17-target-features branch from 1d50046 to ffc6e3b Compare May 19, 2025 15:15
@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the s390x-z17-target-features branch from ffc6e3b to c24e1c3 Compare May 19, 2025 15:41
@folkertdev folkertdev marked this pull request as ready for review May 19, 2025 16:43
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 19, 2025
@folkertdev
Copy link
Contributor Author

r? compiler

Thanks Taiki for the quick suggestions and Ulrich for the review as a target maintainer.

@nnethercote
Copy link
Contributor

The approval from @uweigand is helpful from a SystemZ expert, but we should get someone who knows about this stuff on the rustc side (i.e. not me), therefore:

r? @workingjubilee

@workingjubilee
Copy link
Member

Every other LLVM feature that is still missing is about rather old processor versions (z13 and older) - at this point in time it's no longer useful to write code distinguishing pre-z13 features, those old machines are barely in use any more (if at all).

Oh, do we have an implicit SystemZ architectural minimum, then? That should probably go in the platform-support docs?

@uweigand
Copy link
Contributor

Every other LLVM feature that is still missing is about rather old processor versions (z13 and older) - at this point in time it's no longer useful to write code distinguishing pre-z13 features, those old machines are barely in use any more (if at all).

Oh, do we have an implicit SystemZ architectural minimum, then? That should probably go in the platform-support docs?

I wouldn't consider it an architectural minimum just yet - that's still z10. We can still generate code that works on anything from z10 upwards. I'm just saying at this point in time it is extremely unlikely that any newly written code would still want to add conditional compilation to make distinctions between older machines like z10, z196, zEC12 etc. Newly written code today would likely want to make such distinctions between z17, z16, z15 or so - so that is where we should provide target feature support primarily.

@workingjubilee
Copy link
Member

I'm just saying at this point in time it is extremely unlikely that any newly written code would still want to add conditional compilation to make distinctions between older machines like z10, z196, zEC12 etc.

Ah, that makes sense to me.

@workingjubilee
Copy link
Member

cool,
@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 4, 2025

📌 Commit c24e1c3 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2025
chenyukang added a commit to chenyukang/rust that referenced this pull request Jun 4, 2025
…es, r=workingjubilee

add s390x z17 target features

tracking issue: rust-lang#130869

earlier target features were added in rust-lang#135630, and rust-lang#135413 (comment) has some extra context on these new features.

r? `@ghost`
cc `@uweigand`
bors added a commit that referenced this pull request Jun 4, 2025
Rollup of 6 pull requests

Successful merges:

 - #141250 (add s390x z17 target features)
 - #141570 (Fix incorrect eq_unspanned in TokenStream)
 - #141893 (remove `f16: From<u16>`)
 - #141924 (Lightly tweak docs for BTree{Map,Set}::extract_if)
 - #141959 (Add more missing 2015 edition directives)
 - #141960 (Use non-2015 edition paths in tests that do not test for their resolution)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jun 4, 2025
Rollup of 8 pull requests

Successful merges:

 - #136687 (Improve the documentation of `Display` and `FromStr`, and their interactions)
 - #137306 (Remove `i128` and `u128` from `improper_ctypes_definitions`)
 - #138699 (build dist for x86_64-pc-solaris and sparcv9-sun-solaris)
 - #141250 (add s390x z17 target features)
 - #141467 (make `OsString::new` and `PathBuf::new` unstably const)
 - #141871 (index: add method for checking range on DenseBitSet)
 - #141888 (Use non-2015 edition paths in tests that do not test for their resolution)
 - #142000 (bootstrap: don't symlink source dir into stage0 sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 59bdb5c into rust-lang:master Jun 4, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 4, 2025
rust-timer added a commit that referenced this pull request Jun 4, 2025
Rollup merge of #141250 - folkertdev:s390x-z17-target-features, r=workingjubilee

add s390x z17 target features

tracking issue: #130869

earlier target features were added in #135630, and #135413 (comment) has some extra context on these new features.

r? ``@ghost``
cc ``@uweigand``
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 5, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#136687 (Improve the documentation of `Display` and `FromStr`, and their interactions)
 - rust-lang/rust#137306 (Remove `i128` and `u128` from `improper_ctypes_definitions`)
 - rust-lang/rust#138699 (build dist for x86_64-pc-solaris and sparcv9-sun-solaris)
 - rust-lang/rust#141250 (add s390x z17 target features)
 - rust-lang/rust#141467 (make `OsString::new` and `PathBuf::new` unstably const)
 - rust-lang/rust#141871 (index: add method for checking range on DenseBitSet)
 - rust-lang/rust#141888 (Use non-2015 edition paths in tests that do not test for their resolution)
 - rust-lang/rust#142000 (bootstrap: don't symlink source dir into stage0 sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants