Skip to content

Commit 1a75c54

Browse files
Add Sema testing for +sve+bf16.
1 parent 121b98b commit 1a75c54

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -verify -verify-ignore-unexpected=error,note -emit-llvm -o - %s
2+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -verify -verify-ignore-unexpected=error,note -emit-llvm -o - %s
3+
// REQUIRES: aarch64-registered-target
4+
5+
#include <arm_sve.h>
6+
7+
#if defined __ARM_FEATURE_SME
8+
#define MODE_ATTR __arm_streaming
9+
#else
10+
#define MODE_ATTR
11+
#endif
12+
13+
__attribute__((target("bf16")))
14+
void test_bf16(svbool_t pg, svfloat32_t svf32, svbfloat16_t svbf16, bfloat16_t bf16) MODE_ATTR
15+
{
16+
svbfdot_f32(svf32, svbf16, svbf16);
17+
svbfdot_n_f32(svf32, svbf16, bf16);
18+
svbfdot_lane_f32(svf32, svbf16, svbf16, 0);
19+
20+
svbfmlalb_f32(svf32, svbf16, svbf16);
21+
svbfmlalb_n_f32(svf32, svbf16, bf16);
22+
svbfmlalb_lane_f32(svf32, svbf16, svbf16, 0);
23+
24+
svbfmlalt_f32(svf32, svbf16, svbf16);
25+
svbfmlalt_n_f32(svf32, svbf16, bf16);
26+
svbfmlalt_lane_f32(svf32, svbf16, svbf16, 0);
27+
28+
svcvt_bf16_f32_m(svbf16, pg, svf32);
29+
svcvt_bf16_f32_x(pg, svf32);
30+
svcvt_bf16_f32_z(pg, svf32);
31+
32+
svcvtnt_bf16_f32_m(svbf16, pg, svf32);
33+
svcvtnt_bf16_f32_x(svbf16, pg, svf32);
34+
}
35+
36+
void test_no_bf16(svbool_t pg, svfloat32_t svf32, svbfloat16_t svbf16, bfloat16_t bf16) MODE_ATTR
37+
{
38+
// expected-error@+1 {{'svbfdot_f32' needs target feature (sve,bf16)|(sme,bf16)}}
39+
svbfdot_f32(svf32, svbf16, svbf16);
40+
// expected-error@+1 {{'svbfdot_n_f32' needs target feature (sve,bf16)|(sme,bf16)}}
41+
svbfdot_n_f32(svf32, svbf16, bf16);
42+
// expected-error@+1 {{'svbfdot_lane_f32' needs target feature (sve,bf16)|(sme,bf16)}}
43+
svbfdot_lane_f32(svf32, svbf16, svbf16, 0);
44+
45+
// expected-error@+1 {{'svbfmlalb_f32' needs target feature (sve,bf16)|(sme,bf16)}}
46+
svbfmlalb_f32(svf32, svbf16, svbf16);
47+
// expected-error@+1 {{'svbfmlalb_n_f32' needs target feature (sve,bf16)|(sme,bf16)}}
48+
svbfmlalb_n_f32(svf32, svbf16, bf16);
49+
// expected-error@+1 {{'svbfmlalb_lane_f32' needs target feature (sve,bf16)|(sme,bf16)}}
50+
svbfmlalb_lane_f32(svf32, svbf16, svbf16, 0);
51+
52+
// expected-error@+1 {{'svbfmlalt_f32' needs target feature (sve,bf16)|(sme,bf16)}}
53+
svbfmlalt_f32(svf32, svbf16, svbf16);
54+
// expected-error@+1 {{'svbfmlalt_n_f32' needs target feature (sve,bf16)|(sme,bf16)}}
55+
svbfmlalt_n_f32(svf32, svbf16, bf16);
56+
// expected-error@+1 {{'svbfmlalt_lane_f32' needs target feature (sve,bf16)|(sme,bf16)}}
57+
svbfmlalt_lane_f32(svf32, svbf16, svbf16, 0);
58+
59+
// expected-error@+1 {{'svcvt_bf16_f32_m' needs target feature (sve,bf16)|(sme,bf16)}}
60+
svcvt_bf16_f32_m(svbf16, pg, svf32);
61+
// expected-error@+1 {{'svcvt_bf16_f32_x' needs target feature (sve,bf16)|(sme,bf16)}}
62+
svcvt_bf16_f32_x(pg, svf32);
63+
// expected-error@+1 {{'svcvt_bf16_f32_z' needs target feature (sve,bf16)|(sme,bf16)}}
64+
svcvt_bf16_f32_z(pg, svf32);
65+
66+
// expected-error@+1 {{'svcvtnt_bf16_f32_m' needs target feature (sve,bf16)|(sme,bf16)}}
67+
svcvtnt_bf16_f32_m(svbf16, pg, svf32);
68+
// NOTE: svcvtnt_bf16_f32_x is a macro that expands to svcvtnt_bf16_f32_m.
69+
// expected-error@+1 {{'svcvtnt_bf16_f32_m' needs target feature (sve,bf16)|(sme,bf16)}}
70+
svcvtnt_bf16_f32_x(svbf16, pg, svf32);
71+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -verify -verify-ignore-unexpected=error,note -emit-llvm -o - %s
2+
// REQUIRES: aarch64-registered-target
3+
4+
#include <arm_sve.h>
5+
6+
__attribute__((target("bf16")))
7+
void test_bf16(svfloat32_t svf32, svbfloat16_t svbf16)
8+
{
9+
svbfmmla_f32(svf32, svbf16, svbf16);
10+
}
11+
12+
void test_no_bf16(svfloat32_t svf32, svbfloat16_t svbf16)
13+
{
14+
// expected-error@+1 {{'svbfmmla_f32' needs target feature sve,bf16}}
15+
svbfmmla_f32(svf32, svbf16, svbf16);
16+
}
17+
18+
__attribute__((target("sme,bf16")))
19+
void test_bf16_streaming(svfloat32_t svf32, svbfloat16_t svbf16) __arm_streaming
20+
{
21+
// expected-error@+1 {{builtin can only be called from a non-streaming function}}
22+
svbfmmla_f32(svf32, svbf16, svbf16);
23+
}

0 commit comments

Comments
 (0)