This is an archive of the discontinued LLVM Phabricator instance.

[ARM][AArch64] Add missing v8.x checks
ClosedPublic

Authored by tyb0807 on Dec 22 2021, 3:07 AM.

Details

Summary

This patch adds checks that were missing in clang for Armv8.5/6/7-A. These include:

  • ACLE macro defines for AArch32.
  • Handling of crypto and SM4, SHA and AES feature flags on clang's driver.

Diff Detail

Event Timeline

tmatheson created this revision.Dec 22 2021, 3:07 AM
tmatheson requested review of this revision.Dec 22 2021, 3:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2021, 3:07 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
SjoerdMeijer added a subscriber: SjoerdMeijer.
SjoerdMeijer added inline comments.
clang/lib/Basic/Targets/ARM.cpp
964

Perhaps unrelated to this patch, but I am surprised to see that from v 8.3 and up we only include getTargetDefinesARMV83A, so no other target defines were introduced or are necessary? This is not rhetorical question....I haven't paid attention to this since v8.4.

clang/test/Preprocessor/aarch64-target-features.c
296

I don't pretend to understand the combo x86_64-apple-macosx -arch arm64 here.... but is unrelated to this patch...

298

A test for v8.5 seems to be covered above somehow, but do we not need any tests for v8.6 and v 8.7?

Matt added a subscriber: Matt.Jan 4 2022, 9:39 AM
tyb0807 commandeered this revision.Feb 3 2022, 5:56 AM
tyb0807 added a reviewer: tmatheson.
tyb0807 updated this revision to Diff 405786.Feb 3 2022, 2:21 PM
tyb0807 edited the summary of this revision. (Show Details)

Add more tests

tyb0807 edited the summary of this revision. (Show Details)Feb 3 2022, 2:22 PM
tyb0807 marked 2 inline comments as done.Feb 3 2022, 2:29 PM
tyb0807 added inline comments.
clang/lib/Basic/Targets/ARM.cpp
964

It seems that most of the time, getTargetDefinesARMV8(x)A only includes getTargetDefinesARMV8(x-1)A (see AArch64TargetInfo::getTargetDefines). What we have here is a equivalent way to do that, with less boilerplate code.

tyb0807 edited reviewers, added: lenary; removed: tmatheson.Feb 3 2022, 2:38 PM
tyb0807 marked an inline comment as done.

I don't see any problem with the patch, but we should wait on @SjoerdMeijer.

Ah, sorry, forgot about this. Can you upload the patch with some more context please so I can have a quick look again?

tyb0807 updated this revision to Diff 410310.Feb 21 2022, 8:00 AM
tyb0807 edited the summary of this revision. (Show Details)

Rebase

SjoerdMeijer added inline comments.Feb 21 2022, 8:06 AM
clang/lib/Basic/Targets/ARM.cpp
958

I see tests for the crypto stuff, but is there or do we need a test for whatever getTargetDefinesARMV83A is setting?

tyb0807 added inline comments.Feb 21 2022, 8:29 AM
clang/lib/Basic/Targets/ARM.cpp
958

I'm not sure that we need a test for this, as none of the other architectures really have this. What do you think @SjoerdMeijer @vhscampos ?

SjoerdMeijer added inline comments.Feb 21 2022, 8:36 AM
clang/lib/Basic/Targets/ARM.cpp
958

I am expecting tests for the ACLE macros that this patch defines for v8.7 to be added to clang/test/Preprocessor/arm-target-features.c.

tyb0807 added inline comments.Feb 21 2022, 8:41 AM
clang/lib/Basic/Targets/ARM.cpp
958

In that case, for consistency, I think we should also add tests for ACLE macros for other versions (v8.4/5/6/8) as well. And for AArch64 too. It sounds a bit out of scope, but it ensures consistency IMHO

SjoerdMeijer added inline comments.Feb 21 2022, 8:50 AM
clang/lib/Basic/Targets/ARM.cpp
958

The subject says

[ARM][AArch64] Add missing v8.x checks

so looks perfect in scope to me. :)

tyb0807 updated this revision to Diff 410403.Feb 21 2022, 3:15 PM

Add checks for default ACLE macros for different architecture versions

tyb0807 marked 2 inline comments as done.Feb 21 2022, 3:16 PM
SjoerdMeijer accepted this revision.Feb 22 2022, 12:32 AM

Thanks, looks good!

This revision is now accepted and ready to land.Feb 22 2022, 12:32 AM
This revision was landed with ongoing or failed builds.Feb 22 2022, 1:08 AM
This revision was automatically updated to reflect the committed changes.