Debian Codegraph @

clang/test/Sema/aarch64-sme-streaming-nonstreaming-vl-checks.c

raw
1 // Case 1: No vscale flags — should only produce warnings
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +bf16 -target-feature +sme -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify=expected-noflags %s
3
4 // Case 2: Explicit mismatch in vscale flags — should produce errors for
5 // streaming and non-streaming callers
6 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +bf16 -target-feature +sme -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -mvscale-min=1 -mvscale-max=1 -mvscale-streaming-min=2 -mvscale-streaming-max=2 -verify=expected-flags %s
7
8 void sme_streaming_with_vl_arg(__SVInt8_t a) __arm_streaming;
9
10 __SVInt8_t sme_streaming_returns_vl(void) __arm_streaming;
11
12 void sme_streaming_compatible_with_vl_arg(__SVInt8_t a) __arm_streaming_compatible;
13
14 __SVInt8_t sme_streaming_compatible_returns_vl(void) __arm_streaming_compatible;
15
16 void sme_no_streaming_with_vl_arg(__SVInt8_t a);
17
18 __SVInt8_t sme_no_streaming_returns_vl(void);
19
20
21 void sme_no_streaming_calling_streaming_with_vl_args() {
22 __SVInt8_t a;
23 // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
24 // expected-flags-error@+1 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
25 sme_streaming_with_vl_arg(a);
26 }
27
28 void sme_no_streaming_calling_streaming_with_return_vl() {
29 // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
30 // expected-flags-error@+1 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
31 __SVInt8_t r = sme_streaming_returns_vl();
32 }
33
34 void sme_streaming_calling_non_streaming_with_vl_args(void) __arm_streaming {
35 __SVInt8_t a;
36 // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
37 // expected-flags-error@+1 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
38 sme_no_streaming_with_vl_arg(a);
39 }
40
41 void sme_streaming_calling_non_streaming_with_return_vl(void) __arm_streaming {
42 // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
43 // expected-flags-error@+1 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
44 __SVInt8_t r = sme_no_streaming_returns_vl();
45 }
46
47 void sme_streaming_compatible_calling_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
48 // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
49 // expected-flags-warning@+1 {{passing a VL-dependent argument to a streaming function is undefined behaviour when the streaming-compatible caller is not in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
50 sme_streaming_with_vl_arg(arg);
51 }
52
53 void sme_streaming_compatible_calling_sme_streaming_return_vl(void) __arm_streaming_compatible {
54 // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
55 // expected-flags-warning@+1 {{returning a VL-dependent argument from a streaming function is undefined behaviour when the streaming-compatible caller is not in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
56 __SVInt8_t r = sme_streaming_returns_vl();
57 }
58
59 void sme_streaming_compatible_calling_no_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
60 // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
61 // expected-flags-warning@+1 {{passing a VL-dependent argument to a non-streaming function is undefined behaviour when the streaming-compatible caller is in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
62 sme_no_streaming_with_vl_arg(arg);
63 }
64
65 void sme_streaming_compatible_calling_no_sme_streaming_return_vl(void) __arm_streaming_compatible {
66 // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
67 // expected-flags-warning@+1 {{returning a VL-dependent argument from a non-streaming function is undefined behaviour when the streaming-compatible caller is in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}
68 __SVInt8_t r = sme_no_streaming_returns_vl();
69 }
70
71 void sme_streaming_calling_streaming_with_vl_args(__SVInt8_t a) __arm_streaming {
72 sme_streaming_with_vl_arg(a);
73 }
74
75 void sme_streaming_calling_streaming_with_return_vl(void) __arm_streaming {
76 __SVInt8_t r = sme_streaming_returns_vl();
77 }
78
79 void sme_streaming_calling_streaming_compatible_with_vl_args(__SVInt8_t a) __arm_streaming {
80 sme_streaming_compatible_with_vl_arg(a);
81 }
82
83 void sme_streaming_calling_streaming_compatible_with_return_vl(void) __arm_streaming {
84 __SVInt8_t r = sme_streaming_compatible_returns_vl();
85 }
86
87 void sme_no_streaming_calling_streaming_compatible_with_vl_args() {
88 __SVInt8_t a;
89 sme_streaming_compatible_with_vl_arg(a);
90 }
91
92 void sme_no_streaming_calling_streaming_compatible_with_return_vl() {
93 __SVInt8_t r = sme_streaming_compatible_returns_vl();
94 }
95
96 void sme_no_streaming_calling_non_streaming_with_vl_args() {
97 __SVInt8_t a;
98 sme_no_streaming_with_vl_arg(a);
99 }
100
101 void sme_no_streaming_calling_non_streaming_with_return_vl() {
102 __SVInt8_t r = sme_no_streaming_returns_vl();
103 }
104
105 void sme_streaming_compatible_calling_streaming_compatible_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
106 sme_streaming_compatible_with_vl_arg(arg);
107 }
108
109 void sme_streaming_compatible_calling_streaming_compatible_with_return_vl(void) __arm_streaming_compatible {
110 __SVInt8_t r = sme_streaming_compatible_returns_vl();
111 }