Skip to content

Commit e4e1eed

Browse files
committed
AMDGPU: Allow coldcc calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312936 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1f93574 commit e4e1eed

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

lib/Target/AMDGPU/AMDGPUISelLowering.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForCall(CallingConv::ID CC,
851851
return CC_AMDGPU;
852852
case CallingConv::C:
853853
case CallingConv::Fast:
854+
case CallingConv::Cold:
854855
return CC_AMDGPU_Func;
855856
default:
856857
report_fatal_error("Unsupported calling convention.");
@@ -871,6 +872,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForReturn(CallingConv::ID CC,
871872
return RetCC_SI_Shader;
872873
case CallingConv::C:
873874
case CallingConv::Fast:
875+
case CallingConv::Cold:
874876
return RetCC_AMDGPU_Func;
875877
default:
876878
report_fatal_error("Unsupported calling convention.");

test/CodeGen/AMDGPU/calling-conventions.ll

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,37 @@ define amdgpu_ps half @ps_ret_cc_inreg_f16(half inreg %arg0) {
4343
%add = fadd half %arg0, 1.0
4444
ret half %add
4545
}
46+
47+
; GCN-LABEL: {{^}}fastcc:
48+
; GCN: v_add_f32_e32 v0, 4.0, v0
49+
define fastcc float @fastcc(float %arg0) #0 {
50+
%add = fadd float %arg0, 4.0
51+
ret float %add
52+
}
53+
54+
; GCN-LABEL: {{^}}coldcc:
55+
; GCN: v_add_f32_e32 v0, 4.0, v0
56+
define coldcc float @coldcc(float %arg0) #0 {
57+
%add = fadd float %arg0, 4.0
58+
ret float %add
59+
}
60+
61+
; GCN-LABEL: {{^}}call_coldcc:
62+
; GCN: v_mov_b32_e32 v0, 1.0
63+
; GCN: s_swappc_b64
64+
define amdgpu_kernel void @call_coldcc() #0 {
65+
%val = call float @coldcc(float 1.0)
66+
store float %val, float addrspace(1)* undef
67+
ret void
68+
}
69+
70+
; GCN-LABEL: {{^}}call_fastcc:
71+
; GCN: v_mov_b32_e32 v0, 1.0
72+
; GCN: s_swappc_b64
73+
define amdgpu_kernel void @call_fastcc() #0 {
74+
%val = call float @fastcc(float 1.0)
75+
store float %val, float addrspace(1)* undef
76+
ret void
77+
}
78+
79+
attributes #0 = { nounwind noinline }

0 commit comments

Comments
 (0)