This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.
ClosedPublic

Authored by dmgreen on Aug 3 2022, 3:58 AM.

Details

Summary

We would like to make the ACLE NEON and SVE intrinsics more useable by gating them on the target, not by ifdef preprocessor macros. See #56480. The arm_neon.h file is quite complex to change, so this patch begins with arm_sve.h. This alters the SVEEmitter for arm_sve.h to remove the #ifdef guards and instead use TARGET_BUILTIN with the correct features so that the existing 'func' needs target feature sve error will be generated when sve is not present.

The ArchGuard containing defines in the SVEEmitter are changed to TargetGuard containing target features. In the arm_neon.h emitter there will likely be existing ArchGuard ifdefs mixed with new TargetGuard target feature guards, so the name is change in the SVE too for consistency. The few functions that are present in arm_sve.h (as opposed to builtin aliases) have __attribute__((target(\"sve\"))) added. Some of the tests needed to be rejigged a little, as well as updating the error message, as the error now happens at a later point.

Diff Detail

Event Timeline

dmgreen created this revision.Aug 3 2022, 3:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 3:58 AM
simon_tatham accepted this revision.Aug 3 2022, 6:28 AM

I love it! I'm generally frustrated by any software that says "what even is this, I've never heard of it" when it could so easily change it to "I have heard of this but it's not allowed in this particular context because reason". If nothing else, it means you get different error messages for "misspelled an intrinsic" and "used one from SVE version n+1".

This revision is now accepted and ready to land.Aug 3 2022, 6:28 AM
Matt added a subscriber: Matt.Aug 3 2022, 11:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 4 2023, 3:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript