1 // RUN: %clang_cc1 -fsyntax-only -verify=scalar,neon -std=c++11 \ 2 // RUN: -triple aarch64 -target-cpu cortex-a75 \ 3 // RUN: -target-feature +bf16 -target-feature +neon -Wno-unused %s 4 // RUN: %clang_cc1 -fsyntax-only -verify=scalar,neon -std=c++11 \ 5 // RUN: -triple arm-arm-none-eabi -target-cpu cortex-a53 \ 6 // RUN: -target-feature +bf16 -target-feature +neon -Wno-unused %s 7 8 // The types should be available under AArch64 even without the bf16 feature 9 // RUN: %clang_cc1 -fsyntax-only -verify=scalar -DNONEON -std=c++11 \ 10 // RUN: -triple aarch64 -target-cpu cortex-a75 \ 11 // RUN: -target-feature -bf16 -target-feature +neon -Wno-unused %s 12 13 // REQUIRES: aarch64-registered-target || arm-registered-target 14 test(bool b)15void test(bool b) { 16 __bf16 bf16; 17 18 bf16 + bf16; 19 bf16 - bf16; 20 bf16 * bf16; 21 bf16 / bf16; 22 ++bf16; 23 --bf16; 24 25 __fp16 fp16; 26 27 bf16 + fp16; 28 fp16 + bf16; 29 bf16 - fp16; 30 fp16 - bf16; 31 bf16 * fp16; 32 fp16 * bf16; 33 bf16 / fp16; 34 fp16 / bf16; 35 bf16 = fp16; // scalar-error {{assigning to '__bf16' from incompatible type '__fp16'}} 36 fp16 = bf16; // scalar-error {{assigning to '__fp16' from incompatible type '__bf16'}} 37 bf16 + (b ? fp16 : bf16); 38 } 39 40 #ifndef NONEON 41 42 #include <arm_neon.h> 43 test_vector(bfloat16x4_t a,bfloat16x4_t b,float16x4_t c)44void test_vector(bfloat16x4_t a, bfloat16x4_t b, float16x4_t c) { 45 a + b; 46 a - b; 47 a * b; 48 a / b; 49 50 a + c; 51 a - c; 52 a * c; 53 a / c; 54 c + b; 55 c - b; 56 c * b; 57 c / b; 58 } 59 #endif