mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
AMDGPU: Add f16 to shader calling conventions
Mostly useful for writing tests for f16 features. llvm-svn: 296370
This commit is contained in:
parent
43f49cbc4f
commit
26b489ab08
@ -17,7 +17,7 @@ class CCIfNotInReg<CCAction A> : CCIf<"!ArgFlags.isInReg()", A> {}
|
||||
// Calling convention for SI
|
||||
def CC_SI : CallingConv<[
|
||||
|
||||
CCIfInReg<CCIfType<[f32, i32] , CCAssignToReg<[
|
||||
CCIfInReg<CCIfType<[f32, i32, f16] , CCAssignToReg<[
|
||||
SGPR0, SGPR1, SGPR2, SGPR3, SGPR4, SGPR5, SGPR6, SGPR7,
|
||||
SGPR8, SGPR9, SGPR10, SGPR11, SGPR12, SGPR13, SGPR14, SGPR15,
|
||||
SGPR16, SGPR17, SGPR18, SGPR19, SGPR20, SGPR21, SGPR22, SGPR23,
|
||||
@ -35,7 +35,7 @@ def CC_SI : CallingConv<[
|
||||
>>>,
|
||||
|
||||
// 32*4 + 4 is the minimum for a fetch shader consumer with 32 inputs.
|
||||
CCIfNotInReg<CCIfType<[f32, i32] , CCAssignToReg<[
|
||||
CCIfNotInReg<CCIfType<[f32, i32, f16] , CCAssignToReg<[
|
||||
VGPR0, VGPR1, VGPR2, VGPR3, VGPR4, VGPR5, VGPR6, VGPR7,
|
||||
VGPR8, VGPR9, VGPR10, VGPR11, VGPR12, VGPR13, VGPR14, VGPR15,
|
||||
VGPR16, VGPR17, VGPR18, VGPR19, VGPR20, VGPR21, VGPR22, VGPR23,
|
||||
@ -76,7 +76,7 @@ def RetCC_SI : CallingConv<[
|
||||
]>>,
|
||||
|
||||
// 32*4 + 4 is the minimum for a fetch shader with 32 outputs.
|
||||
CCIfType<[f32] , CCAssignToReg<[
|
||||
CCIfType<[f32, f16] , CCAssignToReg<[
|
||||
VGPR0, VGPR1, VGPR2, VGPR3, VGPR4, VGPR5, VGPR6, VGPR7,
|
||||
VGPR8, VGPR9, VGPR10, VGPR11, VGPR12, VGPR13, VGPR14, VGPR15,
|
||||
VGPR16, VGPR17, VGPR18, VGPR19, VGPR20, VGPR21, VGPR22, VGPR23,
|
||||
|
@ -1,9 +1,10 @@
|
||||
; RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=SI %s
|
||||
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
|
||||
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
|
||||
|
||||
; Make sure we don't crash or assert on spir_kernel calling convention.
|
||||
|
||||
; SI-LABEL: {{^}}kernel:
|
||||
; SI: s_endpgm
|
||||
; GCN-LABEL: {{^}}kernel:
|
||||
; GCN: s_endpgm
|
||||
define spir_kernel void @kernel(i32 addrspace(1)* %out) {
|
||||
entry:
|
||||
store i32 0, i32 addrspace(1)* %out
|
||||
@ -11,10 +12,34 @@ entry:
|
||||
}
|
||||
|
||||
; FIXME: This is treated like a kernel
|
||||
; SI-LABEL: {{^}}func:
|
||||
; SI: s_endpgm
|
||||
; GCN-LABEL: {{^}}func:
|
||||
; GCN: s_endpgm
|
||||
define spir_func void @func(i32 addrspace(1)* %out) {
|
||||
entry:
|
||||
store i32 0, i32 addrspace(1)* %out
|
||||
ret void
|
||||
}
|
||||
|
||||
; GCN-LABEL: {{^}}ps_ret_cc_f16:
|
||||
; SI: v_cvt_f16_f32_e32 v0, v0
|
||||
; SI: v_cvt_f32_f16_e32 v0, v0
|
||||
; SI: v_add_f32_e32 v0, 1.0, v0
|
||||
|
||||
; VI: v_add_f16_e32 v0, 1.0, v0
|
||||
; VI: ; return
|
||||
define amdgpu_ps half @ps_ret_cc_f16(half %arg0) {
|
||||
%add = fadd half %arg0, 1.0
|
||||
ret half %add
|
||||
}
|
||||
|
||||
; GCN-LABEL: {{^}}ps_ret_cc_inreg_f16:
|
||||
; SI: v_cvt_f16_f32_e32 v0, s0
|
||||
; SI: v_cvt_f32_f16_e32 v0, v0
|
||||
; SI: v_add_f32_e32 v0, 1.0, v0
|
||||
|
||||
; VI: v_add_f16_e64 v0, s0, 1.0
|
||||
; VI: ; return
|
||||
define amdgpu_ps half @ps_ret_cc_inreg_f16(half inreg %arg0) {
|
||||
%add = fadd half %arg0, 1.0
|
||||
ret half %add
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user