1 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
3 target datalayout = "A5"
5 ; CHECK: Calling convention requires void return type
6 ; CHECK-NEXT: ptr @nonvoid_cc_amdgpu_kernel
7 define amdgpu_kernel i32 @nonvoid_cc_amdgpu_kernel() {
11 ; CHECK: Calling convention does not support varargs or perfect forwarding!
12 ; CHECK-NEXT: ptr @varargs_amdgpu_kernel
13 define amdgpu_kernel void @varargs_amdgpu_kernel(...) {
17 ; CHECK: Calling convention does not allow sret
18 ; CHECK-NEXT: ptr @sret_cc_amdgpu_kernel_as0
19 define amdgpu_kernel void @sret_cc_amdgpu_kernel_as0(ptr sret(i32) %ptr) {
23 ; CHECK: Calling convention does not allow sret
24 ; CHECK-NEXT: ptr @sret_cc_amdgpu_kernel
25 define amdgpu_kernel void @sret_cc_amdgpu_kernel(ptr addrspace(5) sret(i32) %ptr) {
29 ; CHECK: Calling convention does not support varargs or perfect forwarding!
30 ; CHECK-NEXT: ptr @varargs_amdgpu_vs
31 define amdgpu_vs void @varargs_amdgpu_vs(...) {
35 ; CHECK: Calling convention does not support varargs or perfect forwarding!
36 ; CHECK-NEXT: ptr @varargs_amdgpu_gs
37 define amdgpu_gs void @varargs_amdgpu_gs(...) {
41 ; CHECK: Calling convention does not support varargs or perfect forwarding!
42 ; CHECK-NEXT: ptr @varargs_amdgpu_ps
43 define amdgpu_ps void @varargs_amdgpu_ps(...) {
47 ; CHECK: Calling convention does not support varargs or perfect forwarding!
48 ; CHECK-NEXT: ptr @varargs_amdgpu_cs
49 define amdgpu_cs void @varargs_amdgpu_cs(...) {
53 ; CHECK: Calling convention requires void return type
54 ; CHECK-NEXT: ptr @nonvoid_cc_spir_kernel
55 define spir_kernel i32 @nonvoid_cc_spir_kernel() {
59 ; CHECK: Calling convention does not support varargs or perfect forwarding!
60 ; CHECK-NEXT: ptr @varargs_spir_kernel
61 define spir_kernel void @varargs_spir_kernel(...) {
65 ; CHECK: Calling convention disallows byval
66 ; CHECK-NEXT: ptr @byval_cc_amdgpu_kernel
67 define amdgpu_kernel void @byval_cc_amdgpu_kernel(ptr addrspace(5) byval(i32) %ptr) {
71 ; CHECK: Calling convention disallows byval
72 ; CHECK-NEXT: ptr @byval_as1_cc_amdgpu_kernel
73 define amdgpu_kernel void @byval_as1_cc_amdgpu_kernel(ptr addrspace(1) byval(i32) %ptr) {
77 ; CHECK: Calling convention disallows byval
78 ; CHECK-NEXT: ptr @byval_as0_cc_amdgpu_kernel
79 define amdgpu_kernel void @byval_as0_cc_amdgpu_kernel(ptr byval(i32) %ptr) {
83 ; CHECK: Calling convention disallows byval
84 ; CHECK-NEXT: ptr @byval_cc_amdgpu_vs
85 define amdgpu_vs void @byval_cc_amdgpu_vs(ptr addrspace(5) byval(i32) %ptr) {
89 ; CHECK: Calling convention disallows byval
90 ; CHECK-NEXT: ptr @byval_cc_amdgpu_hs
91 define amdgpu_hs void @byval_cc_amdgpu_hs(ptr addrspace(5) byval(i32) %ptr) {
95 ; CHECK: Calling convention disallows byval
96 ; CHECK-NEXT: ptr @byval_cc_amdgpu_gs
97 define amdgpu_gs void @byval_cc_amdgpu_gs(ptr addrspace(5) byval(i32) %ptr) {
101 ; CHECK: Calling convention disallows byval
102 ; CHECK-NEXT: ptr @byval_cc_amdgpu_ps
103 define amdgpu_ps void @byval_cc_amdgpu_ps(ptr addrspace(5) byval(i32) %ptr) {
107 ; CHECK: Calling convention disallows byval
108 ; CHECK-NEXT: ptr @byval_cc_amdgpu_cs
109 define amdgpu_cs void @byval_cc_amdgpu_cs(ptr addrspace(5) byval(i32) %ptr) {
113 ; CHECK: Calling convention disallows preallocated
114 ; CHECK-NEXT: ptr @preallocated_as0_cc_amdgpu_kernel
115 define amdgpu_kernel void @preallocated_as0_cc_amdgpu_kernel(ptr preallocated(i32) %ptr) {
119 ; CHECK: Calling convention disallows inalloca
120 ; CHECK-NEXT: ptr @inalloca_as0_cc_amdgpu_kernel
121 define amdgpu_kernel void @inalloca_as0_cc_amdgpu_kernel(ptr inalloca(i32) %ptr) {
125 ; CHECK: Calling convention disallows stack byref
126 ; CHECK-NEXT: ptr @byref_as5_cc_amdgpu_kernel
127 define amdgpu_kernel void @byref_as5_cc_amdgpu_kernel(ptr addrspace(5) byref(i32) %ptr) {
131 ; CHECK: Calling convention requires void return type
132 ; CHECK-NEXT: ptr @nonvoid_cc_amdgpu_cs_chain
133 define amdgpu_cs_chain i32 @nonvoid_cc_amdgpu_cs_chain() {
137 ; CHECK: Calling convention does not support varargs or perfect forwarding!
138 ; CHECK-NEXT: ptr @varargs_amdgpu_cs_chain
139 define amdgpu_cs_chain void @varargs_amdgpu_cs_chain(...) {
143 ; CHECK: Calling convention does not allow sret
144 ; CHECK-NEXT: ptr @sret_cc_amdgpu_cs_chain_as0
145 define amdgpu_cs_chain void @sret_cc_amdgpu_cs_chain_as0(ptr sret(i32) %ptr) {
149 ; CHECK: Calling convention disallows byval
150 ; CHECK-NEXT: ptr @byval_cc_amdgpu_cs_chain
151 define amdgpu_cs_chain void @byval_cc_amdgpu_cs_chain(ptr addrspace(1) byval(i32) %ptr) {
155 ; CHECK: Calling convention disallows stack byref
156 ; CHECK-NEXT: ptr @byref_cc_amdgpu_cs_chain
157 define amdgpu_cs_chain void @byref_cc_amdgpu_cs_chain(ptr addrspace(5) byref(i32) %ptr) {
161 ; CHECK: Calling convention disallows preallocated
162 ; CHECK-NEXT: ptr @preallocated_cc_amdgpu_cs_chain
163 define amdgpu_cs_chain void @preallocated_cc_amdgpu_cs_chain(ptr preallocated(i32) %ptr) {
167 ; CHECK: Calling convention disallows inalloca
168 ; CHECK-NEXT: ptr @inalloca_cc_amdgpu_cs_chain
169 define amdgpu_cs_chain void @inalloca_cc_amdgpu_cs_chain(ptr inalloca(i32) %ptr) {
173 ; CHECK: Calling convention requires void return type
174 ; CHECK-NEXT: ptr @nonvoid_cc_amdgpu_cs_chain_preserve
175 define amdgpu_cs_chain_preserve i32 @nonvoid_cc_amdgpu_cs_chain_preserve() {
179 ; CHECK: Calling convention does not support varargs or perfect forwarding!
180 ; CHECK-NEXT: ptr @varargs_amdgpu_cs_chain_preserve
181 define amdgpu_cs_chain_preserve void @varargs_amdgpu_cs_chain_preserve(...) {
185 ; CHECK: Calling convention does not allow sret
186 ; CHECK-NEXT: ptr @sret_cc_amdgpu_cs_chain_preserve_as0
187 define amdgpu_cs_chain_preserve void @sret_cc_amdgpu_cs_chain_preserve_as0(ptr sret(i32) %ptr) {
191 ; CHECK: Calling convention does not allow sret
192 ; CHECK-NEXT: ptr @sret_cc_amdgpu_cs_chain_preserve
193 define amdgpu_cs_chain_preserve void @sret_cc_amdgpu_cs_chain_preserve(ptr addrspace(5) sret(i32) %ptr) {
197 ; CHECK: Calling convention disallows byval
198 ; CHECK-NEXT: ptr @byval_cc_amdgpu_cs_chain_preserve
199 define amdgpu_cs_chain_preserve void @byval_cc_amdgpu_cs_chain_preserve(ptr addrspace(1) byval(i32) %ptr) {
203 ; CHECK: Calling convention disallows stack byref
204 ; CHECK-NEXT: ptr @byref_cc_amdgpu_cs_chain_preserve
205 define amdgpu_cs_chain_preserve void @byref_cc_amdgpu_cs_chain_preserve(ptr addrspace(5) byref(i32) %ptr) {
209 ; CHECK: Calling convention disallows preallocated
210 ; CHECK-NEXT: ptr @preallocated_cc_amdgpu_cs_chain_preserve
211 define amdgpu_cs_chain_preserve void @preallocated_cc_amdgpu_cs_chain_preserve(ptr preallocated(i32) %ptr) {
215 ; CHECK: Calling convention disallows inalloca
216 ; CHECK-NEXT: ptr @inalloca_cc_amdgpu_cs_chain_preserve
217 define amdgpu_cs_chain_preserve void @inalloca_cc_amdgpu_cs_chain_preserve(ptr inalloca(i32) %ptr) {
221 declare amdgpu_cs_chain void @amdgpu_cs_chain_call_target()
222 declare amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_call_target()
224 define amdgpu_cs_chain void @cant_call_amdgpu_cs_chain_functions(ptr %f) {
225 ; CHECK: Direct calls to amdgpu_cs_chain/amdgpu_cs_chain_preserve functions not allowed. Please use the @llvm.amdgpu.cs.chain intrinsic instead.
226 ; CHECK-NEXT: call amdgpu_cs_chain
227 call amdgpu_cs_chain void @amdgpu_cs_chain_call_target()
229 ; CHECK: Direct calls to amdgpu_cs_chain/amdgpu_cs_chain_preserve functions not allowed. Please use the @llvm.amdgpu.cs.chain intrinsic instead.
230 ; CHECK-NEXT: call amdgpu_cs_chain_preserve
231 call amdgpu_cs_chain_preserve void @amdgpu_cs_chain_preserve_call_target()
233 ; CHECK: Direct calls to amdgpu_cs_chain/amdgpu_cs_chain_preserve functions not allowed. Please use the @llvm.amdgpu.cs.chain intrinsic instead.
234 ; CHECK-NEXT: call amdgpu_cs_chain
235 call amdgpu_cs_chain void %f()
237 ; CHECK: Direct calls to amdgpu_cs_chain/amdgpu_cs_chain_preserve functions not allowed. Please use the @llvm.amdgpu.cs.chain intrinsic instead.
238 ; CHECK-NEXT: call amdgpu_cs_chain
239 call amdgpu_cs_chain_preserve void %f()