1 // RUN: %clang_cc1 -fsyntax-only -verify=scalar,neon -std=c++11 \ 2 // RUN: -triple aarch64-arm-none-eabi -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-arm-none-eabi -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 15 void test(bool b) { 16 __bf16 bf16; 17 18 bf16 + bf16; 19 bf16 - bf16; 20 bf16 * bf16; 21 bf16 / bf16; 22 23 __fp16 fp16; 24 25 bf16 + fp16; 26 fp16 + bf16; 27 bf16 - fp16; 28 fp16 - bf16; 29 bf16 * fp16; 30 fp16 * bf16; 31 bf16 / fp16; 32 fp16 / bf16; 33 bf16 = fp16; // scalar-error {{assigning to '__bf16' from incompatible type '__fp16'}} 34 fp16 = bf16; // scalar-error {{assigning to '__fp16' from incompatible type '__bf16'}} 35 bf16 + (b ? fp16 : bf16); 36 } 37 38 #ifndef NONEON 39 40 #include <arm_neon.h> 41 42 void test_vector(bfloat16x4_t a, bfloat16x4_t b, float16x4_t c) { 43 a + b; 44 a - b; 45 a * b; 46 a / b; 47 48 a + c; 49 a - c; 50 a * c; 51 a / c; 52 c + b; 53 c - b; 54 c * b; 55 c / b; 56 } 57 #endif