core: Use __jcvt() intrinsic on AArch64 for f64→i32 conversion#22138
core: Use __jcvt() intrinsic on AArch64 for f64→i32 conversion#22138linkmauve wants to merge 2 commits intoruffle-rs:masterfrom
Conversation
|
Thanks for taking care of it! Ruffle uses stable Rust, so we have to wait until this feature is stabilized. |
|
I’ll try to move forward with the stabilization, in the meantime should I close this PR and reopen it when the intrinsic got stabilized, or should I keep it open as a draft? I originally thought it would be better for stabilization if projects using it were actually using the intrinsic. |
|
It's fine to leave it as a draft. |
|
There are a bunch of red CI actions here, so just checking: the intrinsic works as expected? If so then I'd say we can start the stabilization process in ~ 2 months probably. |
|
In order to check whether the intrinsic works as expected someone with the right hardware would have to run it locally, or GitHub actions would have to be changed (in this PR) to use nightly instead of stable. Currently they are failing because they use stable where this feature is not available. |
|
Well yes either of those would do. I think that with that practical validation, we could move forward with stabilizing the intrinsic. |
In ruffle-rs#21780, an optimisation has been added to use the fjcvtzs ARMv8.3 instruction when available, to convert a f64 into an i32. This made me wonder why core::arch::aarch64 didn’t have an intrinsic for this instruction, so I implemented it in stdarch[1], which got pulled in Rust yesterday[2] (see the tracking issue[3]). This PR makes use of this new intrinsic to remove the unsafe asm!() block, and simplify the code. [1] rust-lang/stdarch#1938 [2] rust-lang/rust#148402 [3] rust-lang/rust#147555
|
Well, the arm and macos jobs succeeded, I guess that means it works? |
|
With only nightly enabled, the tests now pass on both ubuntu-24.04-arm and macos-15! |
In #21780, an optimisation has been added to use the
fjcvtzsARMv8.3 instruction when available, to convert af64into ani32. This made me wonder whycore::arch::aarch64didn’t have an intrinsic for this instruction, so I implemented it in stdarch, which got pulled in Rust yesterday (see the tracking issue).This PR makes use of this new intrinsic to remove the unsafe
asm!()block, and simplify the code.