-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
bn_mul.h: require at least ARMv6 to enable the ARM DSP code #2777
bn_mul.h: require at least ARMv6 to enable the ARM DSP code #2777
Conversation
Commit 16b1bd8 "bn_mul.h: add ARM DSP optimized MULADDC code" added some ARM DSP instructions that was assumed to always be available when __ARM_FEATURE_DSP is defined to 1. Unfortunately it appears that the ARMv5TE architecture (GCC flag -march=armv5te) supports the DSP instructions, but only in Thumb mode and not in ARM mode, despite defining __ARM_FEATURE_DSP in both cases. This patch fixes the build issue by requiring at least ARMv6 in addition to the DSP feature.
Non-regression test for "bn_mul.h: require at least ARMv6 to enable the ARM DSP code"
Without any -O option, the default is -O0, and then the assembly code is not used, so this would not be a non-regression test for the assembly code that doesn't build.
be0a059
to
8a52af9
Compare
There was a bug in the non-regression test which was fixed in 8a52af9, which was to do with compiler optimization flag not set. The test was passing with the fix - 5daa34f, which shouldn't be the case Further, on the investigation, there were a couple of non-regression tests which were not using the optimization flags, but I strongly think this be0a059 needs to be raised as new PR. I'm happy for this PR to be merged. |
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.
The code looks good. I verified locally, that the bug is present without the introduced changes, and that they actually fix it.
I made a minor comment regarding the test's name.
Call the component xxx_arm5vte, because that's what it does. Explain "armel", and more generally why this component exists, in a comment.
2c897d7
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.
Thanks @gilles-peskine-arm for addressing my comment.
Fix the build on ARMv5TE in ARM mode. The assembly code in
bn_mul.h
uses DSP instructions that are not available on this particular architecture, so set the conditional compilation directives to exclude them.Fix originally contributed in #2169 by @aurel32. I rebased to current development to facilitate testing and added a changelog entry and a non-regression test.
Needs backport to 2.16: #2778. The offending code is not present in 2.7.