Open fwh-dc opened 2 months ago
Thanks for the contribution! How would this behave on arm platforms that do not have the sha3 extensions?
Thanks for the contribution! How would this behave on arm platforms that do not have the sha3 extensions?
TBH I don't know and I've trouble finding documentation on these flags. Perhabs you have some suggestions on where to look?
Tagging @hanno-becker to see if he has any insights on ARM compilation flags.
I would recommend only using the sha3
-flag if one is certain that the target platform supports it. Even if the SHA3-instruction-based Keccak implementation is not actually called, there is risk that a clever compiler will leverage general-purpose instructions such as eor3
in (auto-)vectorized code, leading to an invalid instruction abort at runtime.
How does one detect/convey more details about the target in CMake?
In addition, feat.S
should unconditionally guard the code by __ARM_FEATURE_SHA3
(even on Apple).
I would recommend only using the
sha3
-flag if one is certain that the target platform supports it. Even if the SHA3-instruction-based Keccak implementation is not actually called, there is risk that a clever compiler will leverage general-purpose instructions such aseor3
in (auto-)vectorized code, leading to an invalid instruction abort at runtime.How does one detect/convey more details about the target in CMake?
In addition,
feat.S
should unconditionally guard the code by__ARM_FEATURE_SHA3
(even on Apple).
On my Apple M1, __ARM_FEATURE_SHA3 is not defined by default (it will be defined if one compiles with -march=armv8-a+sha3). So I agree with Hanno that currently by default we should compile with -march=armv8-a. A feature detection is recommended to pass +sha3 conditionally.
Thanks for the contribution! How would this behave on arm platforms that do not have the sha3 extensions?
TBH I don't know and I've trouble finding documentation on these flags. Perhabs you have some suggestions on where to look?
The testing macros can be found here: https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros. As hardware varies, you might want to test your target platforms yourself.
Nice thanks. I'll see when I can find the time to have a look at it.
Fixes #1933