Debian Codegraph @

clang/test/Sema/aarch64-incompat-sm-builtin-calls.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3 // RUN: -target-feature +bf16 -target-feature +sve -target-feature +sme -target-feature +sme2 -target-feature +sve2 -target-feature +neon -Waarch64-sme-attributes -fsyntax-only -verify %s
4
5 // REQUIRES: aarch64-registered-target
6
7 #include "arm_neon.h"
8 #include "arm_sme.h"
9 #include "arm_sve.h"
10
11 int16x8_t incompat_neon_sm(int16x8_t splat) __arm_streaming {
12 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
13 return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
14 }
15
16 __arm_locally_streaming int16x8_t incompat_neon_ls(int16x8_t splat) {
17 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
18 return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
19 }
20
21 int16x8_t incompat_neon_smc(int16x8_t splat) __arm_streaming_compatible {
22 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
23 return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
24 }
25
26 void incompat_sme_smc(svbool_t pg, void const *ptr) __arm_streaming_compatible __arm_inout("za") {
27 // expected-error@+1 {{builtin can only be called from a streaming function}}
28 return __builtin_sme_svld1_hor_za128(0, 0, pg, ptr);
29 }
30
31 svuint32_t incompat_sve_sm(svbool_t pg, svuint32_t a, int16_t b) __arm_streaming {
32 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
33 return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
34 }
35
36 // expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
37 // expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
38 __arm_locally_streaming svuint32_t incompat_sve_ls(svbool_t pg, svuint32_t a, int64_t b) {
39 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
40 return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
41 }
42
43 svuint32_t incompat_sve_smc(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming_compatible {
44 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
45 return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
46 }
47
48 svuint32_t incompat_sve2_sm(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming {
49 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
50 return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
51 }
52
53 // expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
54 // expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
55 __arm_locally_streaming svuint32_t incompat_sve2_ls(svbool_t pg, svuint32_t a, int64_t b) {
56 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
57 return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
58 }
59
60 svuint32_t incompat_sve2_smc(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming_compatible {
61 // expected-error@+1 {{builtin can only be called from a non-streaming function}}
62 return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
63 }
64
65 void incompat_sme_sm(svbool_t pn, svbool_t pm, svfloat32_t zn, svfloat32_t zm) __arm_inout("za") {
66 // expected-error@+1 {{builtin can only be called from a streaming function}}
67 svmops_za32_f32_m(0, pn, pm, zn, zm);
68 }
69
70 svfloat64_t streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_streaming {
71 return svadd_n_f64_m(pg, a, b);
72 }
73
74 // expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
75 // expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
76 __arm_locally_streaming svfloat64_t locally_streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) {
77 return svadd_n_f64_m(pg, a, b);
78 }
79
80 svfloat64_t streaming_compatible_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_streaming_compatible {
81 return svadd_n_f64_m(pg, a, b);
82 }
83
84 svint16_t streaming_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming {
85 return svmul_lane_s16(op1, op2, 0);
86 }
87
88 // expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
89 // expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
90 __arm_locally_streaming svint16_t locally_streaming_caller_sve2(svint16_t op1, svint16_t op2) {
91 return svmul_lane_s16(op1, op2, 0);
92 }
93
94 svint16_t streaming_compatible_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming_compatible {
95 return svmul_lane_s16(op1, op2, 0);
96 }
97
98 svbool_t streaming_caller_ptrue(void) __arm_streaming {
99 return svand_z(svptrue_b16(), svptrue_pat_b16(SV_ALL), svptrue_pat_b16(SV_VL4));
100 }
101
102 svint8_t missing_za(svint8_t zd, svbool_t pg, uint32_t slice_base) __arm_streaming {
103 // expected-warning@+1 {{builtin call is not valid when calling from a function without active ZA state}}
104 return svread_hor_za8_s8_m(zd, pg, 0, slice_base);
105 }
106
107 __arm_new("za")
108 svint8_t new_za(svint8_t zd, svbool_t pg, uint32_t slice_base) __arm_streaming {
109 return svread_hor_za8_s8_m(zd, pg, 0, slice_base);
110 }
111
112 void missing_zt0(void) __arm_streaming {
113 // expected-warning@+1 {{builtin call is not valid when calling from a function without active ZT0 state}}
114 svzero_zt(0);
115 }
116
117 __arm_new("zt0")
118 void new_zt0(void) __arm_streaming { svzero_zt(0); }