This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Basic target("+crypto") handling
ClosedPublic

Authored by dmgreen on Jan 19 2023, 9:36 AM.

Details

Summary

This adds some basic handling for target("+crypto") attributes. In this patch it just enabled aes and sha2 regardless of the architecture revision, which matches gccs implementation (and keeps this patch simple).

Diff Detail

Event Timeline

dmgreen created this revision.Jan 19 2023, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 9:36 AM
dmgreen requested review of this revision.Jan 19 2023, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 9:36 AM
tmatheson added a comment.EditedJan 20 2023, 12:07 AM

I'm concerned that the +crypto situation is already confusing, and adding another different meaning for it in the context of the target(...) attribute exacerbates it. Is the plan for this to eventually match the behaviour of -march=...+crypto?

I'm concerned that the +crypto situation is already confusing, and adding another different meaning for it in the context of the target(...) attribute exacerbates it. Is the plan for this to eventually match the behaviour of -march=...+crypto?

Yeah - Considering that GCC has not implemented armv8.4-a+crypto implying +sha3 and +sm4, we either have the option of matching the behavior of GCC's target("+crypto"), or being more consistent with clang's -march=.... With a number of CPU's being released which implement SHA3 but not SM4, the simpler GCC implementation might be the better way to go to be honest, and we could consider changing how -march works in clang to match.

If you feel strongly I can have a go at implementing it to be arch dependent. Let me know.

Matt added a subscriber: Matt.Jan 25 2023, 8:54 AM

By the way I don't really have any more to add, and I've lost track of what the status of +crypto is after all the recent changes, so don't let me block this. From what you've said aligning with GCC sounds sensible, but an intermediate stage where -march does one thing and the target attribute does another seems less ideal.

OK - I think it is worth going forward with this patch so that +crypto at least does something sensible. Otherwise we will get errors like https://github.com/llvm/llvm-project/issues/61645. We can then sort out +crypto at a later point

Ping. I would like to get this into the release so that it isn't quite so broken as it is now. Otherwise +crypto does not do anything for target attributes, and I would like to avoid needing more and more ifdefs based on compiler versions to get correct.

tmatheson accepted this revision.Mar 30 2023, 6:02 AM
This revision is now accepted and ready to land.Mar 30 2023, 6:02 AM
This revision was landed with ongoing or failed builds.Mar 30 2023, 8:47 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 8:47 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript