[PATCH] D137256: [AArch64] Alter arm_fp16.h to be target-based, not preprocessor based.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 08:00:08 PDT 2022


dmgreen created this revision.
dmgreen added reviewers: ilinpv, danielkiss, simon_tatham, stuij, efriedma.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.

As the other recent patches, this alters the arm_fp16 intrinsics to be preprocessor based, not target based. Apparently arm_fp16.h is AArch64 only under clang, making this mostly trivial with the TargetGuard infrastructure.


https://reviews.llvm.org/D137256

Files:
  clang/include/clang/Basic/arm_fp16.td
  clang/test/Sema/aarch64-fp16-target.c


Index: clang/test/Sema/aarch64-fp16-target.c
===================================================================
--- clang/test/Sema/aarch64-fp16-target.c
+++ clang/test/Sema/aarch64-fp16-target.c
@@ -7,19 +7,19 @@
 
 __attribute__((target("fullfp16")))
 void test_fullfp16(float16_t f16) {
-  vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
+  vabdh_f16(f16, f16);
 }
 
 __attribute__((target("arch=armv8-a+fp16")))
 void test_fp16_arch(float16_t f16) {
-    vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
+    vabdh_f16(f16, f16);
 }
 
 __attribute__((target("+fp16")))
 void test_fp16(float16_t f16) {
-    vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
+    vabdh_f16(f16, f16);
 }
 
 void undefined(float16_t f16) {
-  vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
+  vabdh_f16(f16, f16); // expected-error {{'__builtin_neon_vabdh_f16' needs target feature fullfp16}}
 }
Index: clang/include/clang/Basic/arm_fp16.td
===================================================================
--- clang/include/clang/Basic/arm_fp16.td
+++ clang/include/clang/Basic/arm_fp16.td
@@ -14,7 +14,7 @@
 include "arm_neon_incl.td"
 
 // ARMv8.2-A FP16 intrinsics.
-let ArchGuard = "defined(__ARM_FEATURE_FP16_SCALAR_ARITHMETIC) && defined(__aarch64__)" in {
+let ArchGuard = "defined(__aarch64__)", TargetGuard = "fullfp16" in {
 
   // Negate
   def VNEGSH          : SInst<"vneg", "11", "Sh">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137256.472611.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221102/0957b34f/attachment.bin>


More information about the llvm-commits mailing list