This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][ARM] Context sensitive meaning of option "crypto"
ClosedPublic

Authored by SjoerdMeijer on Aug 2 2018, 4:39 AM.

Details

Summary

For AArch64:

  1. Crypto means sm4 + sha3 + sha2 + aes for Armv8.4-A and up,
  2. and sha2 + aes for Armv8.3-A and earlier.

And for AArch32:
Crypto means sha2 + aes, because the Armv8.2-A crypto instructions
were added to AArch64 only.

Diff Detail

Repository
rL LLVM

Event Timeline

SjoerdMeijer created this revision.Aug 2 2018, 4:39 AM
efriedma added inline comments.
lib/Driver/ToolChains/Arch/AArch64.cpp
200 ↗(On Diff #158730)

Yes, this logic should be in TargetParser, not here. Trying to rewrite the target features afterwards is messy at best. (Actually, the target feature list generated by TargetParser probably shouldn't contain the string "crypto" at all.)

Given that this code will go away when TargetParser is fixed, why are you proposing this patch?

219 ↗(On Diff #158730)

Does this need to check for 8.5a?

lib/Driver/ToolChains/Arch/ARM.cpp
430 ↗(On Diff #158730)

The ARM backend doesn't support features named "sha2" and "aes" at the moment.

Hi Eli, thanks for the feedback.

Yes, this logic should be in TargetParser, not here. Trying to rewrite the target features afterwards is messy at best. (Actually, the target feature list generated by TargetParser probably shouldn't contain the string "crypto" at all.)

I appreciate there is room for improvement here, which is an understatement! :) I probably should have mentioned earlier that my colleague is working on targetparser and options, and he will send the proposal in the form of an RFC to the dev list soon. Very briefly, the proposal will elaborate on how we want to capture/enforce architecture extension dependencies (I believe thus also disallow architecturally invalid combinations), imply options, and e.g. warn on redundant options.

I want to move the crypto logic to this new framework as soon it is there. Thus, for the time being, this is a stopgap to demonstrate what we want to achieve (with crypto), and also quite importantly, we have something that works today. But again, I fully agree that the current implementation is far from ideal, but hopefully with these explanations is somewhat acceptable.

SjoerdMeijer added inline comments.Aug 9 2018, 8:33 AM
lib/Driver/ToolChains/Arch/ARM.cpp
430 ↗(On Diff #158730)

These ARM target features were introduced in rL335953.

efriedma added inline comments.Aug 9 2018, 12:17 PM
lib/Driver/ToolChains/Arch/AArch64.cpp
266 ↗(On Diff #158730)

HasV84a is always false; you checked it a few lines earlier. And I think that implies HasV85a is also false? Not sure.

lib/Driver/ToolChains/Arch/ARM.cpp
430 ↗(On Diff #158730)

Hmm, I missed that somehow; okay.

Added FIXMEs, like in D50229, that this needs reimplementation too after the TargerParser rewrite.

About v8.5, the ISA description is now available here:
https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools

But we will add support for that when we upstream v8.5 support, so will be added later.

@efriedma : apologies for the ping, but does this look reasonable?

efriedma accepted this revision.Oct 3 2018, 4:02 PM

LGTM

This revision is now accepted and ready to land.Oct 3 2018, 4:02 PM
This revision was automatically updated to reflect the committed changes.