-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Stabilize ppc inline assembly #147996
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
base: master
Are you sure you want to change the base?
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? |
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. Notably, the consensus was to make this option do nothing on powerpc.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.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 registerThe 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-30]: Reserved for internal usage by LLVMr31: the frame pointervrsave: this is effectively an unused special-purpose register.The following registers are unavailable:
spe_acc,spefscr: These are available exclusively on the SPE target (the e500, not cell). I am not sure how these are actually used. I think they can be added later if needed.mma[0-7]: These are new "registers" available on Power10, they are 512b registers which overlay 4x vsx registers. They could be added if needed, however their usage is very specialized.ap,mq: I don't think these registers exist on any usable power target supported by gcc/llvm.fpscr: it is not modelled by gcc or llvm.vscr: clang/gcc accept this as a clobber, but do not actually save/restore it.cc @taiki-e
r? @Amanieu
@rustbot label +A-inline-assembly