-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add target-specific NaN payloads for the missing tier 2 targets #138870
base: master
Are you sure you want to change the base?
Conversation
I was unable to find authoritative ISA documentation specifically for the tier 3 |
I know I've seen some other discussions about NaN stuff pop up in my notifications recently. As such, passing off as Ralf likely knows better. r? @RalfJung |
This LGTM, but I can't fact-check it so let's wait a bit to give target maintainers time to take a look. |
For |
Looks correct for |
LGTM for For future reference, I came to the conclusion based on this part from
There seems to be some documentation on QNaN values in
|
We'll have to double-check for
Whereas the "source operand priority" is based on the instruction format of individual relevant instructions. So QNaN propagation should be possible on LoongArch, and the preferred QNaN is only generated for operations whose inputs don't involve any NaN, but we'd like to do some experiments to definitely confirm. |
The docs I found for this at https://www.nxp.com/docs/en/reference-manual/SPEPEM.pdf state some truly strange things: The docs also mention software routines can be used to override this behavior, but I don't know if this will happen on a typical instance of this target. If not, this is non-compliant with IEEE 754 and hence unsound for Rust. So probably it'd be better for now to clarify that the statement in the table only refers to powerpc chips with the normal FPU. |
"Case 2" aligns with the |
I've updated the |
This PR adds target-specific NaN payloads for the remaining tier 2 targets:
arm64ec
: This target is a mix ofx86_64
andaarch64
, meaning as they both have no extra payloadsarm64ec
also has no extra payloads.loongarch64
: Per LoongArch Reference Manual - Volume 1: Basic Architecture section 3.1.1.3, LoongArch does quieting NaN propagation with the Rust preferred NaN as its default NaN, meaning it has no extra payloads.nvptx64
: Per PTX ISA documentation section 9.7.3 (and section 9.7.4 forf16
), all payloads are possible. The documentation explicitly states thatf16
andf32
operations result in an unspecified NaN payload, while forf64
it states "NaN payloads are supported" without specifying how or what payload will be generated if there are no input NaNs.powerpc
andpowerpc64
: Per Power Instruction Set Architecture Book I section 4.3.2, PowerPC does quieting NaN propagation with the Rust preferred NaN being generated if no there are no input NaNs, meaning it has no extra payloads.s390x
: Per IBM z/Architecture Principles of Operation page 9-3, s390x does quieting NaN propagation with the Rust's preferred NaN as its default NaN, meaning it has no extra payloads.Tracking issue: #128288
cc @RalfJung
@rustbot label +T-lang
Also cc relevant target maintainers of tier 2 targets:
arm64ec
: @dpaolielloloongarch64
: @heiher @xiangzhai @zhaixiaojuan @xen0nnvptx64
: @RDambrosio016 @kjetilkjekapowerpc
: the only documented maintainer is @BKPepe for the tier 3powerpc-unknown-linux-muslspe
.powerpc64
: @daltenty @gilamn5tr @Gelbpunkt @famfo @neuschaefers390x
: @uweigand @cuviper