Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / arm-bfloat.cpp
blob6a3eacd331d5c46af993d1ecee79a6d82c9d3dff
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
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
13 // REQUIRES: aarch64-registered-target || arm-registered-target
15 void test(bool b) {
16 __bf16 bf16;
18 bf16 + bf16;
19 bf16 - bf16;
20 bf16 * bf16;
21 bf16 / bf16;
22 ++bf16;
23 --bf16;
25 __fp16 fp16;
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);
40 #ifndef NONEON
42 #include <arm_neon.h>
44 void test_vector(bfloat16x4_t a, bfloat16x4_t b, float16x4_t c) {
45 a + b;
46 a - b;
47 a * b;
48 a / b;
50 a + c;
51 a - c;
52 a * c;
53 a / c;
54 c + b;
55 c - b;
56 c * b;
57 c / b;
59 #endif