Stabilize ppc inline assembly#147996
Conversation
These also accept
It would be good to document these as being controlled by |
Specifically that would require a PR like #145656 for s390x, which stabilizes the target features (and presumably also the I'd assume that with this PR merged, stabilizing the |
However, I guess LLVM/GCC could potentially generate code that relies on the VSCR fields being the same before and after inline assembly, when it is not marked as clobbered.
IIRC, these are used to store the results of SPE-specific instructions. That said, since all SPE targets are tier 3, it might be fine to ignore them and proceed with stabilization.
AFAIK, when passing values to inline assembly, the required target features themselves do not need to be stable (since #114467). Btw, s390x is a bit special in that passing values to vector registers in inline assembly requires a separate unstable feature: #133416 (This is due to vector ABI support being added after the inline assembly stabilization.) |
Yes, that would make it even more difficult to correctly mark this a clobber. Making it unusable avoids the question of whether codegen will actually preserve it.
I think the consensus is not to preserve any flags. Notably, XER is partially modeled, but we choose to ignore it. It depends on if and how LLVM/GCC would choose to expose it. |
Yes, that seems reasonable. See #148492. In general, is there any issue against relaxing restrictions post stabilization? Particularly, if we add FPSCR/VSCR preservation requirements for For FPSCR, are there active plans to support it in LLVM? |
6e3ab52 to
2f72ab8
Compare
This comment has been minimized.
This comment has been minimized.
At the very least we need to ensure that This matches the behavior of This should only be a documentation change, nothing needs to be done in the code.
Even if we don't expose these directly as clobbers, we still need to ensure that |
|
I've updated the reference patch require preserving all status and sticky bits of the |
2f72ab8 to
106ca9f
Compare
This comment has been minimized.
This comment has been minimized.
|
I spent some time working on PowerPC support in Amanieu/corosensei#61, which makes heavy use of inline asm. Based on the experience, I think we actually need additional guarantees when executing asm without I also spent some time thinking about the extra register classes that we put into preserve_flags. It's fine to have Finally I think |
Ok. I'll add a section. We should allow ABI sanctioned modifications to the caller's frame. The parameter storage space is another place which could come up in the future. Adding |
|
The only reason for putting it under |
|
I think this is ready for stabilization. @pmur could you write up a stabilization report and then nominate this for the lang team? |
|
☔ The latest upstream changes (presumably #149632) made this pull request unmergeable. Please resolve the merge conflicts. |
106ca9f to
d7d059d
Compare
|
You also need to specifically emit an error on |
If checking is done similiar to other ppc register restrictions, it will error if |
57d5c15 to
31ce232
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I think including As for a stabiization report, I copied the format of the s390 stabilization PR. The language feature stabilization template in the manual doesn't seem like a good fit here. |
|
@rfcbot reviewed |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
|
@Amanieu are there any issues left to resolve here? |
|
@bors r+ |
|
⌛ Testing commit 31ce232 with merge e8cccfb... Workflow: https://github.com/rust-lang/rust/actions/runs/21381154869 |
Stabilize ppc inline assembly This stabilizes inline assembly for PowerPC and PowerPC64. Corresponding reference PR: rust-lang/reference#2056 --- From the requirements of stabilization mentioned in #93335 > Each architecture needs to be reviewed before stabilization: > * It must have clobber_abi. Done in #146949. > * It must be possible to clobber every register that is normally clobbered by a function call. Done in #131341 Similarly, `preserves_flags` is also implemented by this PR. Likewise, there is a non-code change to `preserve_flags` expectations that floating point and vector status and sticky bits are preserved. The reference manual update has more details. > * Generally review that the exposed register classes make sense. The followings can be used as input/output: * reg (`r0`, `r[3-12]`, `r[14-r28]`): Any usable general-purpose register * reg_nonzero (`r[3-12]`, `r[14-r28]`): General-purpose registers, but excludes `r0`. This is needed for instructions which define `r0` to be the value 0, such as register + immediate memory operations. * reg/reg_nonzero `r29` on PowerPC64 targets. * freg (`f[0-31]`): 64 bit floating pointer registers The following are clobber-only: * `ctr`, `lr`, `xer`: commonly clobbered special-purpose registers used in inline asm * `cr` (`cr[0-7]`, `cr`): the condition register fields, or the entire condition register. * `vreg` (`v[0-31]`): altivec/vmx register * `vsreg` (`vs[0-63]`): vector-scalar register * `spe_acc`: SPE accumulator, only available for PowerPC SPE targets. The vreg and vsreg registers technically accept `#[repr(simd)]` types, but require the experimental `altivec` or `vsx` target features to be enabled. That work seems to be tracked here, #42743. The following cannot be used as operands for inline asm: * `r2`: the TOC pointer, required for most PIC code. * `r13`: the TLS pointer * `r[29]`: Reserved for internal usage by LLVM on PowerPC * `r[30]`: Reserved for internal usage by LLVM on PowerPC and PowerPC64 * `r31`: the frame pointer * `vrsave`: this is effectively an unused special-purpose register. The `preserves_flags` behavior is updated with the following behavior (Note, this is not enforceable today due to LLVM restrictions): * All status and sticky bits of `fpscr`, `spefscr`, and `vscr` are preserved. The following registers are unavailable: * `mma[0-7]`: These are new "registers" available on Power10, they are 512b registers which overlay 4x vsx registers. If needed, users can mark such clobbers as vsN*4, vsN*4+1,...,vsN*4+3. * `ap`: This is actually a pseudo-register in gcc/llvm. * `mq`: This register is only available on Power1 and Power2, and is not supported by llvm. --- cc @taiki-e r? @Amanieu @rustbot label +A-inline-assembly
|
@bors yield (to enclosing rollup) |
|
Auto build cancelled. Cancelled workflows: The next pull request likely to be tested is #151716. |
Rollup of 12 pull requests Successful merges: - #147996 (Stabilize ppc inline assembly) - #148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic) - #151137 (checksum-freshness: Fix invalid checksum calculation for binary files) - #151680 (Update backtrace and windows-bindgen) - #150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`) - #151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`) - #151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types) - #151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128) - #151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits) - #151689 (Fix broken Xtensa installation link) - #151699 (Update books) - #151700 (os allow missing_docs)
Rollup merge of #147996 - pmur:murp/stabilize-ppc-inlineasm, r=Amanieu Stabilize ppc inline assembly This stabilizes inline assembly for PowerPC and PowerPC64. Corresponding reference PR: rust-lang/reference#2056 --- From the requirements of stabilization mentioned in #93335 > Each architecture needs to be reviewed before stabilization: > * It must have clobber_abi. Done in #146949. > * It must be possible to clobber every register that is normally clobbered by a function call. Done in #131341 Similarly, `preserves_flags` is also implemented by this PR. Likewise, there is a non-code change to `preserve_flags` expectations that floating point and vector status and sticky bits are preserved. The reference manual update has more details. > * Generally review that the exposed register classes make sense. The followings can be used as input/output: * reg (`r0`, `r[3-12]`, `r[14-r28]`): Any usable general-purpose register * reg_nonzero (`r[3-12]`, `r[14-r28]`): General-purpose registers, but excludes `r0`. This is needed for instructions which define `r0` to be the value 0, such as register + immediate memory operations. * reg/reg_nonzero `r29` on PowerPC64 targets. * freg (`f[0-31]`): 64 bit floating pointer registers The following are clobber-only: * `ctr`, `lr`, `xer`: commonly clobbered special-purpose registers used in inline asm * `cr` (`cr[0-7]`, `cr`): the condition register fields, or the entire condition register. * `vreg` (`v[0-31]`): altivec/vmx register * `vsreg` (`vs[0-63]`): vector-scalar register * `spe_acc`: SPE accumulator, only available for PowerPC SPE targets. The vreg and vsreg registers technically accept `#[repr(simd)]` types, but require the experimental `altivec` or `vsx` target features to be enabled. That work seems to be tracked here, #42743. The following cannot be used as operands for inline asm: * `r2`: the TOC pointer, required for most PIC code. * `r13`: the TLS pointer * `r[29]`: Reserved for internal usage by LLVM on PowerPC * `r[30]`: Reserved for internal usage by LLVM on PowerPC and PowerPC64 * `r31`: the frame pointer * `vrsave`: this is effectively an unused special-purpose register. The `preserves_flags` behavior is updated with the following behavior (Note, this is not enforceable today due to LLVM restrictions): * All status and sticky bits of `fpscr`, `spefscr`, and `vscr` are preserved. The following registers are unavailable: * `mma[0-7]`: These are new "registers" available on Power10, they are 512b registers which overlay 4x vsx registers. If needed, users can mark such clobbers as vsN*4, vsN*4+1,...,vsN*4+3. * `ap`: This is actually a pseudo-register in gcc/llvm. * `mq`: This register is only available on Power1 and Power2, and is not supported by llvm. --- cc @taiki-e r? @Amanieu @rustbot label +A-inline-assembly
Rollup of 12 pull requests Successful merges: - rust-lang/rust#147996 (Stabilize ppc inline assembly) - rust-lang/rust#148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic) - rust-lang/rust#151137 (checksum-freshness: Fix invalid checksum calculation for binary files) - rust-lang/rust#151680 (Update backtrace and windows-bindgen) - rust-lang/rust#150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`) - rust-lang/rust#151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`) - rust-lang/rust#151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types) - rust-lang/rust#151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128) - rust-lang/rust#151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits) - rust-lang/rust#151689 (Fix broken Xtensa installation link) - rust-lang/rust#151699 (Update books) - rust-lang/rust#151700 (os allow missing_docs)
Rollup of 12 pull requests Successful merges: - rust-lang/rust#147996 (Stabilize ppc inline assembly) - rust-lang/rust#148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic) - rust-lang/rust#151137 (checksum-freshness: Fix invalid checksum calculation for binary files) - rust-lang/rust#151680 (Update backtrace and windows-bindgen) - rust-lang/rust#150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`) - rust-lang/rust#151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`) - rust-lang/rust#151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types) - rust-lang/rust#151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128) - rust-lang/rust#151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits) - rust-lang/rust#151689 (Fix broken Xtensa installation link) - rust-lang/rust#151699 (Update books) - rust-lang/rust#151700 (os allow missing_docs)
Rollup of 12 pull requests Successful merges: - rust-lang/rust#147996 (Stabilize ppc inline assembly) - rust-lang/rust#148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic) - rust-lang/rust#151137 (checksum-freshness: Fix invalid checksum calculation for binary files) - rust-lang/rust#151680 (Update backtrace and windows-bindgen) - rust-lang/rust#150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`) - rust-lang/rust#151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`) - rust-lang/rust#151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types) - rust-lang/rust#151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128) - rust-lang/rust#151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits) - rust-lang/rust#151689 (Fix broken Xtensa installation link) - rust-lang/rust#151699 (Update books) - rust-lang/rust#151700 (os allow missing_docs)
Rollup of 12 pull requests Successful merges: - rust-lang/rust#147996 (Stabilize ppc inline assembly) - rust-lang/rust#148718 (Do not mention `-Zmacro-backtrace` for std macros that are a wrapper around a compiler intrinsic) - rust-lang/rust#151137 (checksum-freshness: Fix invalid checksum calculation for binary files) - rust-lang/rust#151680 (Update backtrace and windows-bindgen) - rust-lang/rust#150863 (Adds two new Tier 3 targets - `aarch64v8r-unknown-none{,-softfloat}`) - rust-lang/rust#151040 (Don't expose redundant information in `rustc_public`'s `LayoutShape`) - rust-lang/rust#151383 (remove `#[deprecated]` from unstable & internal `SipHasher13` and `24` types) - rust-lang/rust#151529 (lint: Use rustc_apfloat for `overflowing_literals`, add f16 and f128) - rust-lang/rust#151669 (rename uN::{gather,scatter}_bits to uN::{extract,deposit}_bits) - rust-lang/rust#151689 (Fix broken Xtensa installation link) - rust-lang/rust#151699 (Update books) - rust-lang/rust#151700 (os allow missing_docs)
Pkgsrc changes: * Update version & checksums, and adapt to new libc crate included. Upstream changes relative to 1.94.1: Version 1.95 (2026-04-16) ========================== Language -------- - [Stabilize `if let` guards on match arms] (rust-lang/rust#141295) - [`irrefutable_let_patterns` lint no longer lints on let chains] (rust-lang/rust#146832) - [Support importing path-segment keywords with renaming] (rust-lang/rust#146972) - [Stabilize inline assembly for PowerPC and PowerPC64] (rust-lang/rust#147996) - [const-eval: be more consistent in the behavior of padding during typed copies] (rust-lang/rust#148967) - [Const blocks are no longer evaluated to determine if expressions involving fallible operations can implicitly be constant-promoted.] (rust-lang/rust#150557). Expressions whose ability to implicitly be promoted would depend on the result of a const block are no longer implicitly promoted. - [Make operational semantics of pattern matching independent of crate and module] (rust-lang/rust#150681) Compiler -------- - [Stabilize `--remap-path-scope` for controlling the scoping of how paths get remapped in the resulting binary] (rust-lang/rust#147611) Platform Support ---------------- - [Promote `powerpc64-unknown-linux-musl` to Tier 2 with host tools] (rust-lang/rust#149962) - [Promote `aarch64-apple-tvos` to Tier 2] (rust-lang/rust#152021) - [Promote `aarch64-apple-tvos-sim` to Tier 2] (rust-lang/rust#152021) - [Promote `aarch64-apple-watchos` to Tier 2] (rust-lang/rust#152021) - [Promote `aarch64-apple-watchos-sim` to Tier 2] (rust-lang/rust#152021) - [Promote `aarch64-apple-visionos` to Tier 2] (rust-lang/rust#152021) - [Promote `aarch64-apple-visionos-sim` to Tier 2] (rust-lang/rust#152021) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. https://doc.rust-lang.org/rustc/platform-support.html Libraries --------- - [`thread::scope`: document how join interacts with TLS destructors] (rust-lang/rust#149482) - [Speed up `str::contains` on aarch64 targets with `neon` target feature enabled by default] (rust-lang/rust#152176) Stabilized APIs --------------- - [`MaybeUninit<[T; N]>: From<[MaybeUninit<T>; N]>`] (https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3CMaybeUninit%3C%5BT;+N%5D%3E%3E-for-%5BMaybeUninit%3CT%3E;+N%5D) - [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>; N]>`] (https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>]>`] (https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>; N]>`] (https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>]>`] (https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`[MaybeUninit<T>; N]: From<MaybeUninit<[T; N]>>`] (https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`Cell<[T; N]>: AsRef<[Cell<T>; N]>`] (https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E;+N%5D%3E-for-Cell%3C%5BT;+N%5D%3E) - [`Cell<[T; N]>: AsRef<[Cell<T>]>`] (https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT;+N%5D%3E) - [`Cell<[T]>: AsRef<[Cell<T>]>`] (https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT%5D%3E) - [`bool: TryFrom<{integer}>`] (https://doc.rust-lang.org/stable/std/primitive.bool.html#impl-TryFrom%3Cu128%3E-for-bool) - [`AtomicPtr::update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.update) - [`AtomicPtr::try_update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.try_update) - [`AtomicBool::update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.update) - [`AtomicBool::try_update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.try_update) - [`AtomicIn::update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.update) - [`AtomicIn::try_update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.try_update) - [`AtomicUn::update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.update) - [`AtomicUn::try_update`] (https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.try_update) - [`cfg_select!`] (https://doc.rust-lang.org/stable/std/macro.cfg_select.html) - [`mod core::range`] (https://doc.rust-lang.org/stable/core/range/index.html) - [`core::range::RangeInclusive`] (https://doc.rust-lang.org/stable/core/range/struct.RangeInclusive.html) - [`core::range::RangeInclusiveIter`] (https://doc.rust-lang.org/stable/core/range/struct.RangeInclusiveIter.html) - [`core::hint::cold_path`] (https://doc.rust-lang.org/stable/core/hint/fn.cold_path.html) - [`<*const T>::as_ref_unchecked`] (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked) - [`<*mut T>::as_ref_unchecked`] (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked-1) - [`<*mut T>::as_mut_unchecked`] (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_unchecked) These previously stable APIs are now stable in const contexts: - [`fmt::from_fn`] (https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html) - [`ControlFlow::is_break`] (https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_break) - [`ControlFlow::is_continue`] (https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_continue) Cargo ----- - [docs(report): enhance man pages for `cargo report *`] (rust-lang/cargo#16430) Rustdoc ----- - [In search results, rank unstable items lower] (rust-lang/rust#149460) - [Add new "hide deprecated items" setting in rustdoc] (rust-lang/rust#151091) Compatibility Notes ------------------- - [Array coercions may now result in less inference constraints than before] (rust-lang/rust#140283) - Importing `$crate` without renaming, i.e. `use $crate::{self};`, is now no longer permitted due to stricter error checking for `self` imports. - [const-eval: be more consistent in the behavior of padding during typed copies.] (rust-lang/rust#148967) In very rare cases, this may cause compilation errors due to bytes from parts of a pointer ending up in the padding bytes of a `const` or `static`. - [A future-incompatibility warning lint `ambiguous_glob_imported_traits` is now reported when using an ambiguously glob imported trait] (rust-lang/rust#149058) - [Check lifetime bounds of types mentioning only type parameters] (rust-lang/rust#149389) - [Report more visibility-related ambiguous import errors] (rust-lang/rust#149596) - [Deprecate `Eq::assert_receiver_is_total_eq` and emit future compatibility warnings on manual impls] (rust-lang/rust#149978) - [powerpc64: Use the ELF ABI version set in target spec instead of guessing] (rust-lang/rust#150468) (fixes the ELF ABI used by the OpenBSD target) - Matching on a `#[non_exhaustive]` enum [now reads the discriminant, even if the enum has only one variant] (rust-lang/rust#150681). This can cause closures to capture values that they previously wouldn't. - `mut ref` and `mut ref mut` patterns, part of the unstable [Match Ergonomics 2024 RFC] (rust-lang/rust#123076), were accidentally allowed on stable within struct pattern field shorthand. These patterns are now correctly feature-gated as unstable in this position. - [Add future-compatibility warning for derive helper attributes which conflict with built-in attributes] (rust-lang/rust#151152) - [JSON target specs] (https://doc.rust-lang.org/rustc/targets/custom.html) have been destabilized and now require `-Z unstable-options` to use. Previously, they could not be used without the standard library, which has no stable build mechanism. In preparation for the `build-std` project adding that support, JSON target specs are being proactively gated to ensure they remain unstable even if `build-std` is stabilized. Cargo now includes the `-Z json-target-spec` CLI flag to automatically pass `-Z unstable-options` to the compiler when needed. See [#150151] (rust-lang/rust#150151), [#151534] (rust-lang/rust#150151), and [rust-lang/cargo#16557] (rust-lang/cargo#16557). - [The arguments of `#[feature]` attributes on invalid targets are now checked] (rust-lang/rust#153764) Internal Changes ---------------- These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools. - [Update to LLVM 22](rust-lang/rust#150722)
This stabilizes inline assembly for PowerPC and PowerPC64.
Corresponding reference PR: rust-lang/reference#2056
From the requirements of stabilization mentioned in #93335
Done in #146949.
Done in #131341
Similarly,
preserves_flagsis also implemented by this PR. Likewise, there is a non-code change topreserve_flagsexpectations that floating point and vector status and sticky bits are preserved. The reference manual update has more details.The followings can be used as input/output:
r0,r[3-12],r[14-r28]): Any usable general-purpose registerr[3-12],r[14-r28]): General-purpose registers, but excludesr0. This is needed for instructions which definer0to be the value 0, such as register + immediate memory operations.r29on PowerPC64 targets.f[0-31]): 64 bit floating pointer registersThe following are clobber-only:
ctr,lr,xer: commonly clobbered special-purpose registers used in inline asmcr(cr[0-7],cr): the condition register fields, or the entire condition register.vreg(v[0-31]): altivec/vmx registervsreg(vs[0-63]): vector-scalar registerspe_acc: SPE accumulator, only available for PowerPC SPE targets.The vreg and vsreg registers technically accept
#[repr(simd)]types, but require the experimentalaltivecorvsxtarget features to be enabled. That work seems to be tracked here, #42743.The following cannot be used as operands for inline asm:
r2: the TOC pointer, required for most PIC code.r13: the TLS pointerr[29]: Reserved for internal usage by LLVM on PowerPCr[30]: Reserved for internal usage by LLVM on PowerPC and PowerPC64r31: the frame pointervrsave: this is effectively an unused special-purpose register.The
preserves_flagsbehavior is updated with the following behavior (Note, this is not enforceable today due to LLVM restrictions):fpscr,spefscr, andvscrare preserved.The following registers are unavailable:
mma[0-7]: These are new "registers" available on Power10, they are 512b registers which overlay 4x vsx registers. If needed, users can mark such clobbers as vsN4, vsN4+1,...,vsN*4+3.ap: This is actually a pseudo-register in gcc/llvm.mq: This register is only available on Power1 and Power2, and is not supported by llvm.cc @taiki-e
r? @Amanieu
@rustbot label +A-inline-assembly