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
rsa: use portable intrinsic for 64x64bit multiplication on Win ARM64 #20244
Conversation
"Fixes" is a relative term in the case of software. A fix for one problem can unexpectedly break something else. Does the code once again compile and produce binaries for the VC-WIN64-ARM target? Yes. Do the binaries load and run on Windows ARM64 hardware? Yes. Tested on Win10 ARM64. openssl.exe loads and runs. I also ran a few select items from the test suite: Is it still functionally correct across all platforms, especially supported platforms? I don't know. Win + ARM64 is largely unsupported. Looking at what Microsoft says about |
@slproweb Thanks, I was asking about the compilation error specifically. I'm the original author of the buggy code so I'm aware of the additional requirements of it. But good point about checking if the code is optimal; it's indeed not if the |
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64
2055d23
to
377d3e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The buildbot/master:windows-win10-x86_64 failure looks like a problem with the machine, not the PR |
My preference is for this version of the fix to go in. |
Nitpick: The most recent change that was introduced here makes the assumption that Microsoft will never experiment with other 64-bit architectures other than Intel x64 or ARM64. https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types Only lists a fraction of the hardware architectures Microsoft and Microsoft partners have experimented with over the years. Granted, only a select few ever made it as far as full VS toolchain support with real hardware running the Windows OS. Everything non-Microsoft has the fallback position of the native C implementation. With the native C implementation, at least it'll compile but not run well. Throwing a warning about non-optimal code on all platforms that end up using the native C implementation seems better to me than just failing to compile altogether. But this has already been signed off on. /EndNitpick |
That was intentional. Once you have such a system you will be at the best position to decide which option you want to pursue: use one of the existing intrinsics, use a new intrinsic, or fallback to pure C option. The other platforms don't have the fallback not for new unexpected platforms, but rather for non-gcc, non-clang compilers that don't support 128 bit variables natively. So it will be used when it's both an uncommon platform and an uncommon compiler. |
Obviously a difference of opinion here but, IMO, code should aim to always compile successfully with the sole exception of security considerations, which I don't think applies here. OpenSSL also has a Side note: There doesn't appear to be a CI test for no-asm. The point is largely moot since this has already been accepted but not merged yet. |
24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually. |
Has there been any further discussion on whether this or #20235 is the preferable approach? It seems to me from reading through them that this one probably is - but both PRs have been open and approved for a few days now. |
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Merged to all branches. Thank you for your contribution. |
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from #20244) (cherry picked from commit 075652f)
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from #20244) (cherry picked from commit 075652f)
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from #20244)
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from #20244) (cherry picked from commit 075652f)
@slproweb Any improvements are welcome. Please submit a PR if you have any changes you'd like to be merged. |
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl/openssl#20244)
_umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl/openssl#20244)
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 PR-URL: #46566 Refs: openssl/openssl#20244 Refs: https://mta.openssl.org/pipermail/openssl-announce/2023-February/000251.html Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 PR-URL: #46568 Refs: openssl/openssl#20244 Refs: https://mta.openssl.org/pipermail/openssl-announce/2023-February/000251.html Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 Refs: openssl/openssl#20244
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 PR-URL: nodejs/node#46568 Refs: openssl/openssl#20244 Refs: https://mta.openssl.org/pipermail/openssl-announce/2023-February/000251.html Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Original commit message: rsa: add msvc intrinsic for non x64 platforms _umul128() is x86_64 (x64) only, while __umulh() works everywhere, but doesn't generate optimal code on x64 PR-URL: nodejs/node#46568 Refs: openssl/openssl#20244 Refs: https://mta.openssl.org/pipermail/openssl-announce/2023-February/000251.html Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
_umul128() is x86_64 (x64) only, while __umulh() works both on x64 and ARM64
fixes #20234
Checklist