From e4e1eed1d79d2123d74bcbcb750bc47679b939f1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 11 Sep 2017 18:54:20 +0000 Subject: [PATCH] AMDGPU: Allow coldcc calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312936 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 2 ++ test/CodeGen/AMDGPU/calling-conventions.ll | 34 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 22ca429f1a6..5ace79de89a 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -851,6 +851,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForCall(CallingConv::ID CC, return CC_AMDGPU; case CallingConv::C: case CallingConv::Fast: + case CallingConv::Cold: return CC_AMDGPU_Func; default: report_fatal_error("Unsupported calling convention."); @@ -871,6 +872,7 @@ CCAssignFn *AMDGPUCallLowering::CCAssignFnForReturn(CallingConv::ID CC, return RetCC_SI_Shader; case CallingConv::C: case CallingConv::Fast: + case CallingConv::Cold: return RetCC_AMDGPU_Func; default: report_fatal_error("Unsupported calling convention."); diff --git a/test/CodeGen/AMDGPU/calling-conventions.ll b/test/CodeGen/AMDGPU/calling-conventions.ll index 677147b6f4e..9bf94a1f2da 100644 --- a/test/CodeGen/AMDGPU/calling-conventions.ll +++ b/test/CodeGen/AMDGPU/calling-conventions.ll @@ -43,3 +43,37 @@ define amdgpu_ps half @ps_ret_cc_inreg_f16(half inreg %arg0) { %add = fadd half %arg0, 1.0 ret half %add } + +; GCN-LABEL: {{^}}fastcc: +; GCN: v_add_f32_e32 v0, 4.0, v0 +define fastcc float @fastcc(float %arg0) #0 { + %add = fadd float %arg0, 4.0 + ret float %add +} + +; GCN-LABEL: {{^}}coldcc: +; GCN: v_add_f32_e32 v0, 4.0, v0 +define coldcc float @coldcc(float %arg0) #0 { + %add = fadd float %arg0, 4.0 + ret float %add +} + +; GCN-LABEL: {{^}}call_coldcc: +; GCN: v_mov_b32_e32 v0, 1.0 +; GCN: s_swappc_b64 +define amdgpu_kernel void @call_coldcc() #0 { + %val = call float @coldcc(float 1.0) + store float %val, float addrspace(1)* undef + ret void +} + +; GCN-LABEL: {{^}}call_fastcc: +; GCN: v_mov_b32_e32 v0, 1.0 +; GCN: s_swappc_b64 +define amdgpu_kernel void @call_fastcc() #0 { + %val = call float @fastcc(float 1.0) + store float %val, float addrspace(1)* undef + ret void +} + +attributes #0 = { nounwind noinline } \ No newline at end of file -- 2.50.1