Skip to content

Commit e7deca5

Browse files
committed
[AArch64] Alter arm_fp16.h to be target-based, not preprocessor based.
As the other recent patches, this alters the arm_fp16 intrinsics to be target based, not preprocessor based. Apparently arm_fp16.h is AArch64 only under clang, making this mostly trivial with the TargetGuard infrastructure. Differential Revision: https://reviews.llvm.org/D137256
1 parent 473d001 commit e7deca5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clang/include/clang/Basic/arm_fp16.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
include "arm_neon_incl.td"
1515

1616
// ARMv8.2-A FP16 intrinsics.
17-
let ArchGuard = "defined(__ARM_FEATURE_FP16_SCALAR_ARITHMETIC) && defined(__aarch64__)" in {
17+
let ArchGuard = "defined(__aarch64__)", TargetGuard = "fullfp16" in {
1818

1919
// Negate
2020
def VNEGSH : SInst<"vneg", "11", "Sh">;

clang/test/Sema/aarch64-fp16-target.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
__attribute__((target("fullfp16")))
99
void test_fullfp16(float16_t f16) {
10-
vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
10+
vabdh_f16(f16, f16);
1111
}
1212

1313
__attribute__((target("arch=armv8-a+fp16")))
1414
void test_fp16_arch(float16_t f16) {
15-
vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
15+
vabdh_f16(f16, f16);
1616
}
1717

1818
__attribute__((target("+fp16")))
1919
void test_fp16(float16_t f16) {
20-
vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
20+
vabdh_f16(f16, f16);
2121
}
2222

2323
void undefined(float16_t f16) {
24-
vabdh_f16(f16, f16); // expected-error {{call to undeclared function 'vabdh_f16'}}
24+
vabdh_f16(f16, f16); // expected-error {{'__builtin_neon_vabdh_f16' needs target feature fullfp16}}
2525
}

0 commit comments

Comments
 (0)