-
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
AES-NI: use target attributes for x86 32-bit intrinsics #8406
Conversation
Hi @beni-sandu , Thanks a lot for the contribution. I have kicked off the CI on your PR so we will get some feedback shortly. |
Note to maintainers: Internal CI failures are spurious. OpenCI has passed. Marking ready for review. |
It would be good to add a build test for clang and gcc in |
Thanks for the feedback @daverodgman, I have addressed your comments. Seems there was a test for aesni 32-bit intrinsics in all.sh, I have added one for clang too, let me know if that is enough. |
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, thanks!
Thanks @tom-cosgrove-arm , fixed now. |
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, thanks
OpenCI is reporting failures, PTAL:
|
The error is because Ubuntu 16.04 has clang 4.0, which doesn't know about the target attribute. So we'll need a check in |
I think it's easier to just check the clang version inside Something like this inside
I have used >= 4 for clang version, but I am actually not sure if it's okay or needs to be > 4, and cannot double check on my side at the moment. |
ping @tom-daubney-arm or @daverodgman for second review? |
@tom-cosgrove-arm I think no changelog because the other PR relating to the common issue #8334 has a changelog? |
Conflicts with #8374 |
Interesting, #8374 mentions that clang does not define I will have another look at this soon. |
Sorry, probably not very clear. When clang is used as part of Visual Studio, it is run as the "clang cl driver", |
PR needs updating to avoid conflict with #8374
This way we build with 32-bit gcc/clang out of the box. We also fallback to assembly for 64-bit clang-cl if needed cpu flags are not provided, instead of throwing an error. Signed-off-by: Beniamin Sandu <[email protected]>
Signed-off-by: Beniamin Sandu <[email protected]>
I had a closer look at this, and based on my tests, seems there is some inconsistency between what #8374 is describing in the details and what is actually fixing, unless I am misunderstanding something, or there is a different behaviour in environment because of e.g. versions used. I understood that one could not compile with clang-cl at all before that patch, with or without CPU flags, but on my side, it was building fine when flags were provided, and throwing an error about missing intrinsics functions when flags are not used. With that patch, it is now throwing an error about missing CPU flags, so it's better. I anyways reworked my first patch to include those changes and the current behaviour of the development branch in my tests was as follows: On Windows 10:
On Linux Ubuntu 22.04:
Changes added by the patch in this PR:On Windows 10:
On Linux Ubuntu 22.04:
Please let me know what you think. |
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 for the thorough testing. LGTM
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
mbedtls fails to build on 32-bit Linux without passing some compiler options. We pass them through an environment variable, which is not the best way to do it, but here we are. Hopefully this will be able to be removed whenever mbedtls pushes a new release; seems that this has been fixed upstream in merge Mbed-TLS/mbedtls#8406.
Description
Add target attributes for 32-bit builds to compile with intrinsics out of the box.
This fixes 32-bit compilation issues (e.g. #8334 and #8400).
For 64-bit, assembly will still be used if cpu flags are not passed when building.
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")
Tested that it builds fine on:
Windows 10: MINGW 32-bit/64-bit (13.0.2), Clang 32-bit/64-bit (17.0.1)
Linux Ubuntu 22.04: gcc 32-bit/64-bit (11.4.0), Clang 32-bit/64-bit (14.0.0)
Let me know if there is some better way of doing this.