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 {
297297// / directly or indirectly via a call-like instruction.
298298constexpr bool isCallableCC (CallingConv::ID CC) {
299299 switch (CC) {
300+ // Called with special intrinsics:
301+ // llvm.amdgcn.cs.chain
300302 case CallingConv::AMDGPU_CS_Chain:
301303 case CallingConv::AMDGPU_CS_ChainPreserve:
304+ // llvm.amdgcn.call.whole.wave
305+ case CallingConv::AMDGPU_Gfx_WholeWave:
306+ // Hardware entry points:
302307 case CallingConv::AMDGPU_CS:
303308 case CallingConv::AMDGPU_ES:
304309 case CallingConv::AMDGPU_GS:
Original file line number Diff line number Diff line change @@ -2975,6 +2975,16 @@ void Verifier::visitFunction(const Function &F) {
29752975 " perfect forwarding!" ,
29762976 &F);
29772977 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 ;
29782988 }
29792989
29802990 // 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()
564564; CHECK: declare riscv_vls_cc(32768) void @riscv_vls_cc_32768()
565565declare riscv_vls_cc(65536 ) void @riscv_vls_cc_65536 ()
566566; 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)
567571declare cc1023 void @f.cc1023 ()
568572; CHECK: declare cc1023 void @f.cc1023()
569573
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
217217define amdgpu_cs_chain_preserve void @inalloca_cc_amdgpu_cs_chain_preserve (ptr inalloca (i32 ) %ptr ) {
218218 ret void
219219}
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