Debian Codegraph @

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

raw
1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon -verify -emit-llvm -o - %s
2 // REQUIRES: aarch64-registered-target
3
4 // Test that functions with the correct target attributes can use the correct FP16 intrinsics.
5
6 #include <arm_fp16.h>
7
8 __attribute__((target("fullfp16")))
9 void test_fullfp16(float16_t f16) {
10 vabdh_f16(f16, f16);
11 }
12
13 __attribute__((target("fp16")))
14 void fp16(float16_t f16) {
15 vabdh_f16(f16, f16);
16 }
17
18 __attribute__((target("arch=armv8-a+fp16")))
19 void test_fp16_arch(float16_t f16) {
20 vabdh_f16(f16, f16);
21 }
22
23 __attribute__((target("+fp16")))
24 void test_plusfp16(float16_t f16) {
25 vabdh_f16(f16, f16);
26 }
27
28 void undefined(float16_t f16) {
29 vabdh_f16(f16, f16); // expected-error {{'__builtin_neon_vabdh_f16' needs target feature fullfp16}}
30 }