Lines Matching full:llvm

4 // RUN: mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics %s | FileCheck %s --check-prefix=CHECK-LLVM
7 // GENERIC: "llvm.func"
8 // GENERIC-SAME: function_type = !llvm.func<void ()>
11 // CHECK: llvm.func @foo()
12 "llvm.func" () ({
13 }) {sym_name = "foo", function_type = !llvm.func<void ()>} : () -> ()
15 // GENERIC: "llvm.func"
16 // GENERIC-SAME: function_type = !llvm.func<i64 (i64, i64)>
19 // CHECK: llvm.func @bar(i64, i64) -> i64
20 "llvm.func"() ({
21 }) {sym_name = "bar", function_type = !llvm.func<i64 (i64, i64)>} : () -> ()
23 // GENERIC: "llvm.func"
24 // GENERIC-SAME: function_type = !llvm.func<i64 (i64)>
26 // CHECK: llvm.func @baz(%{{.*}}: i64) -> i64
27 "llvm.func"() <{sym_name = "baz", function_type = !llvm.func<i64 (i64)>}> ({
30 // GENERIC: llvm.return
31 llvm.return %arg0 : i64
36 // CHECK: llvm.func @qux(!llvm.ptr {llvm.noalias}, i64)
38 "llvm.func"() ({
39 }) {sym_name = "qux", function_type = !llvm.func<void (ptr, i64)>,
40 arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> ()
42 // CHECK: llvm.func @roundtrip1()
43 llvm.func @roundtrip1()
45 // CHECK: llvm.func @roundtrip2(i64, f32) -> f64
46 llvm.func @roundtrip2(i64, f32) -> f64
48 // CHECK: llvm.func @roundtrip3(i32, i1)
49 llvm.func @roundtrip3(%a: i32, %b: i1)
51 // CHECK: llvm.func @roundtrip4(%{{.*}}: i32, %{{.*}}: i1) {
52 llvm.func @roundtrip4(%a: i32, %b: i1) {
53 llvm.return
56 // CHECK: llvm.func @roundtrip5()
58 llvm.func @roundtrip5() attributes {foo = "bar", baz = 42}
60 // CHECK: llvm.func @roundtrip6()
62 llvm.func @roundtrip6() attributes {foo = "bar", baz = 42} {
63 llvm.return
66 // CHECK: llvm.func @roundtrip7() {
67 llvm.func @roundtrip7() attributes {} {
68 llvm.return
71 // CHECK: llvm.func @roundtrip8() -> i32
72 llvm.func @roundtrip8() -> i32 attributes {}
74 // CHECK: llvm.func @roundtrip9(!llvm.ptr {llvm.noalias})
75 llvm.func @roundtrip9(!llvm.ptr {llvm.noalias})
77 // CHECK: llvm.func @roundtrip10(!llvm.ptr {llvm.noalias})
78 llvm.func @roundtrip10(%arg0: !llvm.ptr {llvm.noalias})
80 // CHECK: llvm.func @roundtrip11(%{{.*}}: !llvm.ptr {llvm.noalias}) {
81 llvm.func @roundtrip11(%arg0: !llvm.ptr {llvm.noalias}) {
82 llvm.return
85 // CHECK: llvm.func @roundtrip12(%{{.*}}: !llvm.ptr {llvm.noalias})
87 llvm.func @roundtrip12(%arg0: !llvm.ptr {llvm.noalias})
89 llvm.return
92 // CHECK: llvm.func @byvalattr(%{{.*}}: !llvm.ptr {llvm.byval = i32})
93 llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) {
94 llvm.return
97 // CHECK: llvm.func @sretattr(%{{.*}}: !llvm.ptr {llvm.sret = i32})
98 // LOCINFO: llvm.func @sretattr(%{{.*}}: !llvm.ptr {llvm.sret = i32} loc("some_source_loc"))
99 llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32} loc("some_source_loc")) {
100 llvm.return
103 // CHECK: llvm.func @nestattr(%{{.*}}: !llvm.ptr {llvm.nest})
104 llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) {
105 llvm.return
108 // CHECK: llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias})
109 llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias})
110 // CHECK: llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32})
111 llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32})
112 // CHECK: llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32})
113 llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32})
114 // CHECK: llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32})
115 llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32})
116 // CHECK: llvm.func @nestattr_decl(!llvm.ptr {llvm.nest})
117 llvm.func @nestattr_decl(!llvm.ptr {llvm.nest})
118 // CHECK: llvm.func @noundefattr_decl(i32 {llvm.noundef})
119 llvm.func @noundefattr_decl(i32 {llvm.noundef})
120 // CHECK: llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4 : i64})
121 llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4})
122 // CHECK: llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32})
123 llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32})
126 // CHECK: llvm.func @variadic(...)
127 llvm.func @variadic(...)
129 // CHECK: llvm.func @variadic_args(i32, i32, ...)
130 llvm.func @variadic_args(i32, i32, ...)
136 // CHECK: llvm.func internal
137 llvm.func internal @internal_func() {
138 llvm.return
141 // CHECK: llvm.func weak
142 llvm.func weak @weak_linkage() {
143 llvm.return
146 // CHECK-LLVM: define ptx_kernel void @calling_conv
147 llvm.func ptx_kernelcc @calling_conv() {
148 llvm.return
154 // CHECK: llvm.func @external_func
155 // GENERIC: linkage = #llvm.linkage<external>
156 llvm.func external @external_func()
158 // CHECK-LABEL: llvm.func @arg_struct_attr(
159 // CHECK-SAME: %{{.*}}: !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) {
160 llvm.func @arg_struct_attr(
161 %arg0 : !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) {
162 llvm.return
165 // CHECK-LABEL: llvm.func @res_struct_attr(%{{.*}}: !llvm.struct<(i32)>)
166 // CHECK-SAME:-> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) {
167 llvm.func @res_struct_attr(%arg0 : !llvm.struct<(i32)>)
168 -> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) {
169 llvm.return %arg0 : !llvm.struct<(i32)>
172 // CHECK: llvm.func @cconv1
173 llvm.func ccc @cconv1() {
174 llvm.return
177 // CHECK: llvm.func weak @cconv2
178 llvm.func weak ccc @cconv2() {
179 llvm.return
182 // CHECK: llvm.func weak fastcc @cconv3
183 llvm.func weak fastcc @cconv3() {
184 llvm.return
187 // CHECK: llvm.func cc_10 @cconv4
188 llvm.func cc_10 @cconv4() {
189 llvm.return
192 // CHECK: llvm.func @test_ccs
193 llvm.func @test_ccs() {
194 // CHECK-NEXT: %[[PTR:.*]] = llvm.mlir.addressof @cconv4 : !llvm.ptr
195 %ptr = llvm.mlir.addressof @cconv4 : !llvm.ptr
196 // CHECK-NEXT: llvm.call @cconv1() : () -> ()
197 // CHECK-NEXT: llvm.call @cconv2() : () -> ()
198 // CHECK-NEXT: llvm.call fastcc @cconv3() : () -> ()
199 // CHECK-NEXT: llvm.call cc_10 %[[PTR]]() : !llvm.ptr, () -> ()
200 llvm.call @cconv1() : () -> ()
201 llvm.call ccc @cconv2() : () -> ()
202 llvm.call fastcc @cconv3() : () -> ()
203 llvm.call cc_10 %ptr() : !llvm.ptr, () -> ()
204 llvm.return
207 // CHECK-LABEL: llvm.func @variadic_def
208 llvm.func @variadic_def(...) {
209 llvm.return
212 // CHECK-LABEL: llvm.func @memory_attr
213 // CHECK-SAME: attributes {memory = #llvm.memory_effects<other = none, argMem = read, inaccessibleMem = readwrite>} {
214 llvm.func @memory_attr() attributes {memory = #llvm.memory_effects<other = none, argMem = read, inaccessibleMem = readwrite>} {
215 llvm.return
218 // CHECK-LABEL: llvm.func hidden @hidden
219 llvm.func hidden @hidden() {
220 llvm.return
223 // CHECK-LABEL: llvm.func protected @protected
224 llvm.func protected @protected() {
225 llvm.return
229 llvm.func local_unnamed_addr @local_unnamed_addr_func() {
230 llvm.return
235 llvm.func @align_func() attributes {alignment = 2 : i64} {
236 llvm.return
239 // CHECK: llvm.comdat @__llvm_comdat
240 llvm.comdat @__llvm_comdat {
241 // CHECK: llvm.comdat_selector @any any
242 llvm.comdat_selector @any any
245 llvm.func @any() comdat(@__llvm_comdat::@any) attributes { dso_local } {
246 llvm.return
249 llvm.func @vscale_roundtrip() vscale_range(1, 2) {
252 llvm.return
256 // CHECK-SAME: attributes {frame_pointer = #llvm.framePointerKind<"non-leaf">}
257 llvm.func @frame_pointer_roundtrip() attributes {frame_pointer = #llvm.framePointerKind<"non-leaf">} {
258 llvm.return
261 llvm.func @unsafe_fp_math_roundtrip() attributes {unsafe_fp_math = true} {
264 llvm.return
267 llvm.func @no_infs_fp_math_roundtrip() attributes {no_infs_fp_math = true} {
270 llvm.return
273 llvm.func @no_nans_fp_math_roundtrip() attributes {no_nans_fp_math = true} {
276 llvm.return
279 llvm.func @approx_func_fp_math_roundtrip() attributes {approx_func_fp_math = true} {
282 llvm.return
285 llvm.func @no_signed_zeros_fp_math_roundtrip() attributes {no_signed_zeros_fp_math = true} {
288 llvm.return
291 llvm.func @convergent_function() attributes {convergent} {
294 llvm.return
297 llvm.func @denormal_fp_math_roundtrip() attributes {denormal_fp_math = "preserve-sign"} {
300 llvm.return
303 llvm.func @denormal_fp_math_f32_roundtrip() attributes {denormal_fp_math_f32 = "preserve-sign"} {
306 llvm.return
309 llvm.func @fp_contract_roundtrip() attributes {fp_contract = "fast"} {
312 llvm.return
315 llvm.func @nounwind_function() attributes {no_unwind} {
318 llvm.return
321 llvm.func @willreturn_function() attributes {will_return} {
324 llvm.return
334 "llvm.func"() {function_type = !llvm.func<void ()>, sym_name = "no_region"} : () -> ()
341 "llvm.func"() ({}) {sym_name = "missing_type"} : () -> ()
347 // expected-error@+1 {{attribute 'function_type' failed to satisfy constraint: type attribute of LLVM function type}}
348 "llvm.func"() ({}) {sym_name = "non_llvm_type", function_type = i64} : () -> ()
354 // expected-error@+1 {{attribute 'function_type' failed to satisfy constraint: type attribute of LLVM function type}}
355 "llvm.func"() ({}) {sym_name = "non_function_type", function_type = i64} : () -> ()
362 "llvm.func"() ({
364 llvm.return
365 }) {function_type = !llvm.func<void ()>, sym_name = "wrong_arg_number"} : () -> ()
372 "llvm.func"() ({
374 llvm.return
375 }) {function_type = !llvm.func<void (i64)>, sym_name = "wrong_arg_number"} : () -> ()
381 // expected-error@+1 {{failed to construct function type: expected LLVM type for function arguments}}
382 llvm.func @foo(tensor<*xf32>)
388 // expected-error@+1 {{failed to construct function type: expected LLVM type for function results}}
389 llvm.func @foo() -> tensor<*xf32>
396 llvm.func @foo() -> (i64, i64)
403 llvm.func @variadic_inside(%arg0: i32, ..., %arg1: i32)
410 llvm.func internal @internal_external_func()
417 llvm.func common @common_linkage_func()
423 // expected-error@+1 {{custom op 'llvm.func' expected valid '@'-identifier for symbol name}}
424 llvm.func cc_12 @unknown_calling_convention()
430 "llvm.func"() ({
433 }) {sym_name = "generic_unknown_calling_convention", CConv = #llvm.cconv<cc_12>, function_type = !llvm.func<i64 (i64, i64)>} : () -> ()
439 // CHECK-SAME: vec_type_hint = #llvm.vec_type_hint<hint = i32>
440 llvm.func @vec_type_hint() attributes {vec_type_hint = #llvm.vec_type_hint<hint = i32>}
443 // CHECK-SAME: vec_type_hint = #llvm.vec_type_hint<hint = i32, is_signed = true>
444 llvm.func @vec_type_hint_signed() attributes {vec_type_hint = #llvm.vec_type_hint<hint = i32, is_signed = true>}
447 // CHECK-SAME: vec_type_hint = #llvm.vec_type_hint<hint = vector<2xi32>, is_signed = true>
448 llvm.func @vec_type_hint_signed_vec() attributes {vec_type_hint = #llvm.vec_type_hint<hint = vector<2xi32>, is_signed = true>}
451 // CHECK-SAME: vec_type_hint = #llvm.vec_type_hint<hint = vector<3xf32>>
452 llvm.func @vec_type_hint_float_vec() attributes {vec_type_hint = #llvm.vec_type_hint<hint = vector<3xf32>>}
455 // CHECK-SAME: vec_type_hint = #llvm.vec_type_hint<hint = vector<8xbf16>>
456 llvm.func @vec_type_hint_bfloat_vec() attributes {vec_type_hint = #llvm.vec_type_hint<hint = vector<8xbf16>>}
462 llvm.func @work_group_size_hint() attributes {work_group_size_hint = array<i32: 128, 128, 128>}
468 llvm.func @reqd_work_group_size_hint() attributes {reqd_work_group_size = array<i32: 128, 256, 128>}
474 llvm.func @intel_reqd_sub_group_size_hint() attributes {llvm.intel_reqd_sub_group_size = 32 : i32}
479 // CHECK-SAME: llvm.workgroup_attribution = #llvm.mlir.workgroup_attribution<512 : i64, i32>
480 // CHECK-SAME: llvm.workgroup_attribution = #llvm.mlir.workgroup_attribution<128 : i64, !llvm.struct<(i32, i64, f32)>
481 llvm.func @workgroup_attribution(%arg0: !llvm.ptr {llvm.workgroup_attribution = #llvm.mlir.workgroup_attribution<512 : i64, i32>}, %arg1: !llvm.ptr {llvm.workgroup_attribution = #llvm.mlir.workgroup_attribution<128 : i64, !llvm.struct<(i32, i64, f32)>>})
486 // CHECK-SAME: llvm.range = #llvm.constant_range<i32, 0, -2147483648>
487 llvm.func @constant_range_negative() -> (i32 {llvm.range = #llvm.constant_range<i32, 0, -2147483648>})