xref: /llvm-project/clang/test/CodeGen/AArch64/targetattr.c (revision 84fa1755a5b7845ddaeaa513a3786013c76c9c88)
1207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-globals
2207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64 -emit-llvm %s -o - | FileCheck %s
3207e5cccSFangrui Song 
4207e5cccSFangrui Song __attribute__((target("arch=armv8.2-a")))
5207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v82
6207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR0:[0-9]+]] {
7207e5cccSFangrui Song // CHECK-NEXT:  entry:
8207e5cccSFangrui Song // CHECK-NEXT:    ret void
9207e5cccSFangrui Song //
10207e5cccSFangrui Song void v82() {}
11207e5cccSFangrui Song __attribute__((target("arch=armv8.2-a+sve")))
12207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v82sve
13207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR1:[0-9]+]] {
14207e5cccSFangrui Song // CHECK-NEXT:  entry:
15207e5cccSFangrui Song // CHECK-NEXT:    ret void
16207e5cccSFangrui Song //
17207e5cccSFangrui Song void v82sve() {}
18207e5cccSFangrui Song __attribute__((target("arch=armv8.2-a+sve2")))
19207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v82sve2
20207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR2:[0-9]+]] {
21207e5cccSFangrui Song // CHECK-NEXT:  entry:
22207e5cccSFangrui Song // CHECK-NEXT:    ret void
23207e5cccSFangrui Song //
24207e5cccSFangrui Song void v82sve2() {}
25207e5cccSFangrui Song __attribute__((target("arch=armv8.2-a+sve+sve2")))
26207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v82svesve2
27207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR2]] {
28207e5cccSFangrui Song // CHECK-NEXT:  entry:
29207e5cccSFangrui Song // CHECK-NEXT:    ret void
30207e5cccSFangrui Song //
31207e5cccSFangrui Song void v82svesve2() {}
32207e5cccSFangrui Song __attribute__((target("arch=armv8.6-a+sve2")))
33207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v86sve2
34207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR3:[0-9]+]] {
35207e5cccSFangrui Song // CHECK-NEXT:  entry:
36207e5cccSFangrui Song // CHECK-NEXT:    ret void
37207e5cccSFangrui Song //
38207e5cccSFangrui Song void v86sve2() {}
39207e5cccSFangrui Song 
40207e5cccSFangrui Song __attribute__((target("cpu=cortex-a710")))
41207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@a710
42207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR4:[0-9]+]] {
43207e5cccSFangrui Song // CHECK-NEXT:  entry:
44207e5cccSFangrui Song // CHECK-NEXT:    ret void
45207e5cccSFangrui Song //
46207e5cccSFangrui Song void a710() {}
47207e5cccSFangrui Song __attribute__((target("tune=cortex-a710")))
48207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@tunea710
49207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR5:[0-9]+]] {
50207e5cccSFangrui Song // CHECK-NEXT:  entry:
51207e5cccSFangrui Song // CHECK-NEXT:    ret void
52207e5cccSFangrui Song //
53207e5cccSFangrui Song void tunea710() {}
54207e5cccSFangrui Song __attribute__((target("cpu=generic")))
55207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@generic
56207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR6:[0-9]+]] {
57207e5cccSFangrui Song // CHECK-NEXT:  entry:
58207e5cccSFangrui Song // CHECK-NEXT:    ret void
59207e5cccSFangrui Song //
60207e5cccSFangrui Song void generic() {}
61207e5cccSFangrui Song __attribute__((target("tune=generic")))
62207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@tune
63207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR7:[0-9]+]] {
64207e5cccSFangrui Song // CHECK-NEXT:  entry:
65207e5cccSFangrui Song // CHECK-NEXT:    ret void
66207e5cccSFangrui Song //
67207e5cccSFangrui Song void tune() {}
68207e5cccSFangrui Song 
69207e5cccSFangrui Song __attribute__((target("cpu=neoverse-n1,tune=cortex-a710")))
70207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@n1tunea710
71207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR8:[0-9]+]] {
72207e5cccSFangrui Song // CHECK-NEXT:  entry:
73207e5cccSFangrui Song // CHECK-NEXT:    ret void
74207e5cccSFangrui Song //
75207e5cccSFangrui Song void n1tunea710() {}
76207e5cccSFangrui Song __attribute__((target("sve,tune=cortex-a710")))
77207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@svetunea710
78207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR9:[0-9]+]] {
79207e5cccSFangrui Song // CHECK-NEXT:  entry:
80207e5cccSFangrui Song // CHECK-NEXT:    ret void
81207e5cccSFangrui Song //
82207e5cccSFangrui Song void svetunea710() {}
83207e5cccSFangrui Song __attribute__((target("+sve,tune=cortex-a710")))
84207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plussvetunea710
85207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR9]] {
86207e5cccSFangrui Song // CHECK-NEXT:  entry:
87207e5cccSFangrui Song // CHECK-NEXT:    ret void
88207e5cccSFangrui Song //
89207e5cccSFangrui Song void plussvetunea710() {}
90207e5cccSFangrui Song __attribute__((target("cpu=neoverse-v1,+sve2")))
91207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v1plussve2
92207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR10:[0-9]+]] {
93207e5cccSFangrui Song // CHECK-NEXT:  entry:
94207e5cccSFangrui Song // CHECK-NEXT:    ret void
95207e5cccSFangrui Song //
96207e5cccSFangrui Song void v1plussve2() {}
97207e5cccSFangrui Song __attribute__((target("cpu=neoverse-v1+sve2")))
98207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v1sve2
99207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR10]] {
100207e5cccSFangrui Song // CHECK-NEXT:  entry:
101207e5cccSFangrui Song // CHECK-NEXT:    ret void
102207e5cccSFangrui Song //
103207e5cccSFangrui Song void v1sve2() {}
104207e5cccSFangrui Song __attribute__((target("cpu=neoverse-v1,+nosve")))
105207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v1minussve
106207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR11:[0-9]+]] {
107207e5cccSFangrui Song // CHECK-NEXT:  entry:
108207e5cccSFangrui Song // CHECK-NEXT:    ret void
109207e5cccSFangrui Song //
110207e5cccSFangrui Song void v1minussve() {}
111207e5cccSFangrui Song __attribute__((target("cpu=neoverse-v1,no-sve")))
112207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v1nosve
113207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR11]] {
114207e5cccSFangrui Song // CHECK-NEXT:  entry:
115207e5cccSFangrui Song // CHECK-NEXT:    ret void
116207e5cccSFangrui Song //
117207e5cccSFangrui Song void v1nosve() {}
118207e5cccSFangrui Song __attribute__((target("cpu=neoverse-v1+nosve")))
119207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@v1msve
120207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR11]] {
121207e5cccSFangrui Song // CHECK-NEXT:  entry:
122207e5cccSFangrui Song // CHECK-NEXT:    ret void
123207e5cccSFangrui Song //
124207e5cccSFangrui Song void v1msve() {}
125207e5cccSFangrui Song 
126207e5cccSFangrui Song __attribute__((target("+sve")))
127207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plussve
128207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR12:[0-9]+]] {
129207e5cccSFangrui Song // CHECK-NEXT:  entry:
130207e5cccSFangrui Song // CHECK-NEXT:    ret void
131207e5cccSFangrui Song //
132207e5cccSFangrui Song void plussve() {}
133207e5cccSFangrui Song __attribute__((target("+sve+nosve2")))
134207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plussveplussve2
135207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR12]] {
136207e5cccSFangrui Song // CHECK-NEXT:  entry:
137207e5cccSFangrui Song // CHECK-NEXT:    ret void
138207e5cccSFangrui Song //
139207e5cccSFangrui Song void plussveplussve2() {}
140207e5cccSFangrui Song __attribute__((target("sve,no-sve2")))
141207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plussveminusnosve2
142207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR12]] {
143207e5cccSFangrui Song // CHECK-NEXT:  entry:
144207e5cccSFangrui Song // CHECK-NEXT:    ret void
145207e5cccSFangrui Song //
146207e5cccSFangrui Song void plussveminusnosve2() {}
147207e5cccSFangrui Song __attribute__((target("+fp16")))
148207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plusfp16
149207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR13:[0-9]+]] {
150207e5cccSFangrui Song // CHECK-NEXT:  entry:
151207e5cccSFangrui Song // CHECK-NEXT:    ret void
152207e5cccSFangrui Song //
153207e5cccSFangrui Song void plusfp16() {}
154207e5cccSFangrui Song 
155207e5cccSFangrui Song __attribute__((target("cpu=neoverse-n1,tune=cortex-a710,arch=armv8.6-a+sve2")))
156207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@all
157207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR14:[0-9]+]] {
158207e5cccSFangrui Song // CHECK-NEXT:  entry:
159207e5cccSFangrui Song // CHECK-NEXT:    ret void
160207e5cccSFangrui Song //
161207e5cccSFangrui Song void all() {}
162207e5cccSFangrui Song __attribute__((target("cpu=neoverse-n1,tune=cortex-a710,arch=armv8.6-a+sve2,branch-protection=standard")))
163207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@allplusbranchprotection
164207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR15:[0-9]+]] {
165207e5cccSFangrui Song // CHECK-NEXT:  entry:
166207e5cccSFangrui Song // CHECK-NEXT:    ret void
167207e5cccSFangrui Song //
168207e5cccSFangrui Song void allplusbranchprotection() {}
169207e5cccSFangrui Song 
170207e5cccSFangrui Song __attribute__((target("+nosimd")))
171207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@plusnosimd
172207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR16:[0-9]+]] {
173207e5cccSFangrui Song // CHECK-NEXT:  entry:
174207e5cccSFangrui Song // CHECK-NEXT:    ret void
175207e5cccSFangrui Song //
176207e5cccSFangrui Song void plusnosimd() {}
177207e5cccSFangrui Song __attribute__((target("no-simd")))
178207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@nosimd
179207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR16]] {
180207e5cccSFangrui Song // CHECK-NEXT:  entry:
181207e5cccSFangrui Song // CHECK-NEXT:    ret void
182207e5cccSFangrui Song //
183207e5cccSFangrui Song void nosimd() {}
184207e5cccSFangrui Song 
185207e5cccSFangrui Song // This isn't part of the standard interface, but test that -arch features should not apply anything else.
186207e5cccSFangrui Song __attribute__((target("no-v9.3a")))
187207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@minusarch
188207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR17:[0-9]+]] {
189207e5cccSFangrui Song // CHECK-NEXT:  entry:
190207e5cccSFangrui Song // CHECK-NEXT:    ret void
191207e5cccSFangrui Song //
192207e5cccSFangrui Song void minusarch() {}
193207e5cccSFangrui Song 
194207e5cccSFangrui Song __attribute__((target("cpu=apple-m4")))
195207e5cccSFangrui Song // CHECK-LABEL: define {{[^@]+}}@applem4
196207e5cccSFangrui Song // CHECK-SAME: () #[[ATTR18:[0-9]+]] {
197207e5cccSFangrui Song // CHECK-NEXT:  entry:
198207e5cccSFangrui Song // CHECK-NEXT:    ret void
199207e5cccSFangrui Song //
200207e5cccSFangrui Song void applem4() {}
201207e5cccSFangrui Song 
202207e5cccSFangrui Song //.
203207e5cccSFangrui Song // CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+lse,+neon,+ras,+rdm,+v8.1a,+v8.2a,+v8a" }
204207e5cccSFangrui Song // CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a" }
205207e5cccSFangrui Song // CHECK: attributes #[[ATTR2]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8a" }
206207e5cccSFangrui Song // CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+predres,+ras,+rcpc,+rdm,+sb,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" }
20792564850SCarolineConcatto // CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a710" "target-features"="+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+ete,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+ssbs,+sve,+sve-bitperm,+sve2,+trbe,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+v9a" }
208207e5cccSFangrui Song // CHECK: attributes #[[ATTR5]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="cortex-a710" }
209207e5cccSFangrui Song // CHECK: attributes #[[ATTR6]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+ete,+fp-armv8,+neon,+trbe,+v8a" }
210207e5cccSFangrui Song // CHECK: attributes #[[ATTR7]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="generic" }
211207e5cccSFangrui Song // CHECK: attributes #[[ATTR8]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+v8.1a,+v8.2a,+v8a" "tune-cpu"="cortex-a710" }
212207e5cccSFangrui Song // CHECK: attributes #[[ATTR9]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" "tune-cpu"="cortex-a710" }
213207e5cccSFangrui Song // CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" }
214207e5cccSFangrui Song // CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,-sve" }
215207e5cccSFangrui Song // CHECK: attributes #[[ATTR12]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" }
216207e5cccSFangrui Song // CHECK: attributes #[[ATTR13]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16" }
217207e5cccSFangrui Song // CHECK: attributes #[[ATTR14]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" }
218207e5cccSFangrui Song // CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone "branch-target-enforcement" "guarded-control-stack" "no-trapping-math"="true" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" }
219207e5cccSFangrui Song // CHECK: attributes #[[ATTR16]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
220207e5cccSFangrui Song // CHECK: attributes #[[ATTR17]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.3a" }
221*84fa1755SOliver Stannard // CHECK: attributes #[[ATTR18]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fpac,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+sme,+sme-f64f64,+sme-i16i64,+sme2,+spe-eef,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8.7a,+v8a,+wfxt" }
222207e5cccSFangrui Song //.
223207e5cccSFangrui Song // CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
224207e5cccSFangrui Song // CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
225207e5cccSFangrui Song //.
226