File tree Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -297,8 +297,13 @@ namespace CallingConv {
297
297
// / directly or indirectly via a call-like instruction.
298
298
constexpr bool isCallableCC (CallingConv::ID CC) {
299
299
switch (CC) {
300
+ // Called with special intrinsics:
301
+ // llvm.amdgcn.cs.chain
300
302
case CallingConv::AMDGPU_CS_Chain:
301
303
case CallingConv::AMDGPU_CS_ChainPreserve:
304
+ // llvm.amdgcn.call.whole.wave
305
+ case CallingConv::AMDGPU_Gfx_WholeWave:
306
+ // Hardware entry points:
302
307
case CallingConv::AMDGPU_CS:
303
308
case CallingConv::AMDGPU_ES:
304
309
case CallingConv::AMDGPU_GS:
Original file line number Diff line number Diff line change @@ -2975,6 +2975,16 @@ void Verifier::visitFunction(const Function &F) {
2975
2975
" perfect forwarding!" ,
2976
2976
&F);
2977
2977
break ;
2978
+ case CallingConv::AMDGPU_Gfx_WholeWave:
2979
+ Check (F.arg_size () != 0 && F.arg_begin ()->getType ()->isIntegerTy (1 ),
2980
+ " Calling convention requires first argument to be i1" , &F);
2981
+ Check (!F.arg_begin ()->hasInRegAttr (),
2982
+ " Calling convention requires first argument to not be inreg" , &F);
2983
+ Check (!F.isVarArg (),
2984
+ " Calling convention does not support varargs or "
2985
+ " perfect forwarding!" ,
2986
+ &F);
2987
+ break ;
2978
2988
}
2979
2989
2980
2990
// Check that the argument values match the function type for this function...
Original file line number Diff line number Diff line change @@ -564,6 +564,10 @@ declare riscv_vls_cc(32768) void @riscv_vls_cc_32768()
564
564
; CHECK: declare riscv_vls_cc(32768) void @riscv_vls_cc_32768()
565
565
declare riscv_vls_cc(65536 ) void @riscv_vls_cc_65536 ()
566
566
; CHECK: declare riscv_vls_cc(65536) void @riscv_vls_cc_65536()
567
+ declare cc124 void @f.cc124 (i1 )
568
+ ; CHECK: declare amdgpu_gfx_whole_wave void @f.cc124(i1)
569
+ declare amdgpu_gfx_whole_wave void @f.amdgpu_gfx_whole_wave (i1 )
570
+ ; CHECK: declare amdgpu_gfx_whole_wave void @f.amdgpu_gfx_whole_wave(i1)
567
571
declare cc1023 void @f.cc1023 ()
568
572
; CHECK: declare cc1023 void @f.cc1023()
569
573
Original file line number Diff line number Diff line change @@ -217,3 +217,36 @@ define amdgpu_cs_chain_preserve void @preallocated_cc_amdgpu_cs_chain_preserve(p
217
217
define amdgpu_cs_chain_preserve void @inalloca_cc_amdgpu_cs_chain_preserve (ptr inalloca (i32 ) %ptr ) {
218
218
ret void
219
219
}
220
+
221
+ ; CHECK: Calling convention requires first argument to be i1
222
+ ; CHECK-NEXT: ptr @whole_wave_no_args
223
+ define amdgpu_gfx_whole_wave void @whole_wave_no_args () {
224
+ ret void
225
+ }
226
+
227
+ ; CHECK: Calling convention requires first argument to be i1
228
+ ; CHECK-NEXT: ptr @whole_wave_must_have_i1_active
229
+ define amdgpu_gfx_whole_wave void @whole_wave_must_have_i1_active (i32 %x ) {
230
+ ret void
231
+ }
232
+
233
+ ; CHECK: Calling convention requires first argument to not be inreg
234
+ ; CHECK-NEXT: ptr @whole_wave_i1_active_inreg
235
+ define amdgpu_gfx_whole_wave void @whole_wave_i1_active_inreg (i1 inreg %active ) {
236
+ ret void
237
+ }
238
+
239
+ ; CHECK: Calling convention does not support varargs
240
+ ; CHECK-NEXT: ptr @whole_wave_varargs
241
+ define amdgpu_gfx_whole_wave void @whole_wave_varargs (i1 %active , i32 %x , ...) {
242
+ ret void
243
+ }
244
+
245
+ declare amdgpu_gfx_whole_wave void @whole_wave_callee (i1 %active )
246
+
247
+ ; CHECK: calling convention does not permit calls
248
+ ; CHECK-NEXT: call amdgpu_gfx_whole_wave void @whole_wave_callee(i1 true)
249
+ define amdgpu_cs void @cant_call_whole_wave_func () {
250
+ call amdgpu_gfx_whole_wave void @whole_wave_callee (i1 true )
251
+ ret void
252
+ }
You can’t perform that action at this time.
0 commit comments