This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Make -march and target("arch=..") attributes imply dependent features
ClosedPublic

Authored by dmgreen on Jan 10 2023, 10:37 AM.

Details

Summary

Specifying an architecture revision should also add feature strings for any dependent default extensions. Otherwise the new checks for target-dependent features for acle intrinsics from D134353 and D132034 can fail.

This patch does that in setFeatureEnabled, similar to the addition of dependent architecture revisions. +sve also needs to be added to armv9 architectures in the target parser, as it is implied by +sve2.

Fixes #59911

Diff Detail

Event Timeline

dmgreen created this revision.Jan 10 2023, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 10:37 AM
dmgreen requested review of this revision.Jan 10 2023, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 10:37 AM
danielkiss accepted this revision.Jan 10 2023, 11:44 AM

jut a NIT, LGTM otherwise.

clang/lib/Basic/Targets/AArch64.cpp
748

what do you think?

This revision is now accepted and ready to land.Jan 10 2023, 11:44 AM
Matt added a subscriber: Matt.Jan 10 2023, 3:53 PM
This revision was landed with ongoing or failed builds.Jan 11 2023, 12:48 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 12:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
lenary added a subscriber: lenary.Jan 11 2023, 2:40 AM

Can we check this logic, especially around adding both AEK_SVE and AEK_SVE2 in the AARCH64_ARCH descriptions, this means that -march=armv9-a+nosve2 still can generate sve instructions. I'm not entirely sure of the intended behaviour there, especially as sve2 should maybe imply sve by other means (iirc, there's a place higher up in AArch64TargetParser.def with the implied features?)

Can we check this logic, especially around adding both AEK_SVE and AEK_SVE2 in the AARCH64_ARCH descriptions, this means that -march=armv9-a+nosve2 still can generate sve instructions. I'm not entirely sure of the intended behaviour there, especially as sve2 should maybe imply sve by other means (iirc, there's a place higher up in AArch64TargetParser.def with the implied features?)

Hello. I would expect -march=armv9-a+nosve2 to still enable sve, and as far as I can tell (correct me if I'm wrong!) that is how this worked both before and after this patch. There is some code in the driver that already adds +sve and +sve2 TargetFeatures if the architecture is v9a. A lot of that code in the Driver shouldn't really be in their though, as it won't apply to target("arch=..") attributes correctly.

It does look like this might be enabling Crypto in places it was not in the past though. I'll look into why that is.