This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][ARM] Alter v8.1a neon intrinsics to be target-based, not preprocessor based
ClosedPublic

Authored by dmgreen on Oct 10 2022, 1:22 PM.

Details

Summary

As a continuation of D132034, this switches the QRDMX v8.1a neon intrinsics over from preprocessor defines to be target-gated. As there is no "rdma" or "qrdmx" target feature, they use the "v8.1a" architecture feature directly.

This works well for AArch64, but something needs to be done for Arm at the same time, as they both use the same header and tablegen emitter. This patch opts for adding "v8.1a" and all dependant target features to the Arm TargetParser, similar to what was recently done for AArch64 but through initFeatureMap when the Architecture is parsed. I attempted to make the code similar to the AArch64 backend. Alternative suggestions are welcome.

Otherwise this is similar to the changes made in D132034.

Diff Detail

Event Timeline

dmgreen created this revision.Oct 10 2022, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 1:22 PM
dmgreen requested review of this revision.Oct 10 2022, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 1:22 PM
simon_tatham added inline comments.Oct 24 2022, 3:00 AM
clang/lib/CodeGen/CGBuiltin.cpp
5868

This patch mostly looks comprehensible to me, but I don't understand what this change has to do with it. Everything else seems to be controlling how intrinsics are enabled/disabled, but the changes in this file seem to be renaming some intrinsics, and there's nothing about that in the commit message.

Is this intentionally part of the same patch?

dmgreen added inline comments.Oct 24 2022, 3:39 AM
clang/lib/CodeGen/CGBuiltin.cpp
5868

It is to do with the tablegen emitter and how the __builtin_arm_vqrdmlshq_s32 are defined, vs the old __builtin_arm_vqrdmlshq_v name. It comes from https://reviews.llvm.org/D132034.

The short version is that because some intrinsics need different target features for different types, they cannot share the same _v builtin names. For example the _f16 or _bf16 builtins need different features to _f32, using a TARGET_BUILTIN in the generated files, as opposed to BUILTIN. This means that anything that has a TargetGuard no longer uses the _v common name, and in cases like this we end up with different names. In this case they could probably share the name again as all intrinsics require the same features, but as there are only 2 names I chose to keep it simple and just expand the NEONMAP for the new names.

simon_tatham accepted this revision.Oct 24 2022, 5:38 AM

Ah, yes, now I see it. Thanks for clarifying.

This revision is now accepted and ready to land.Oct 24 2022, 5:38 AM
This revision was landed with ongoing or failed builds.Oct 25 2022, 1:03 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2022, 1:03 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript