2017-09-08 01:14:54 +08:00
|
|
|
# RUN: llc -march=amdgcn -mcpu=gfx803 -run-pass si-memory-legalizer %s -o - | FileCheck %s
|
|
|
|
|
|
|
|
--- |
|
|
|
|
define amdgpu_kernel void @multiple_mem_operands(i32 addrspace(1)* %out, i32 %cond, i32 %if_offset, i32 %else_offset) #0 {
|
|
|
|
entry:
|
2018-02-03 00:07:16 +08:00
|
|
|
%scratch0 = alloca [8192 x i32], addrspace(5)
|
|
|
|
%scratch1 = alloca [8192 x i32], addrspace(5)
|
|
|
|
%scratchptr01 = bitcast [8192 x i32] addrspace(5)* %scratch0 to i32 addrspace(5)*
|
|
|
|
store i32 1, i32 addrspace(5)* %scratchptr01
|
|
|
|
%scratchptr12 = bitcast [8192 x i32] addrspace(5)* %scratch1 to i32 addrspace(5)*
|
|
|
|
store i32 2, i32 addrspace(5)* %scratchptr12
|
2017-09-08 01:14:54 +08:00
|
|
|
%cmp = icmp eq i32 %cond, 0
|
|
|
|
br i1 %cmp, label %if, label %else, !structurizecfg.uniform !0, !amdgpu.uniform !0
|
|
|
|
|
|
|
|
if: ; preds = %entry
|
2018-02-03 00:07:16 +08:00
|
|
|
%if_ptr = getelementptr [8192 x i32], [8192 x i32] addrspace(5)* %scratch0, i32 0, i32 %if_offset, !amdgpu.uniform !0
|
|
|
|
%if_value = load i32, i32 addrspace(5)* %if_ptr, align 4, !nontemporal !1
|
2017-09-08 01:14:54 +08:00
|
|
|
br label %done, !structurizecfg.uniform !0
|
|
|
|
|
|
|
|
else: ; preds = %entry
|
2018-02-03 00:07:16 +08:00
|
|
|
%else_ptr = getelementptr [8192 x i32], [8192 x i32] addrspace(5)* %scratch1, i32 0, i32 %else_offset, !amdgpu.uniform !0
|
|
|
|
%else_value = load i32, i32 addrspace(5)* %else_ptr, align 4, !nontemporal !1
|
2017-09-08 01:14:54 +08:00
|
|
|
br label %done, !structurizecfg.uniform !0
|
|
|
|
|
|
|
|
done: ; preds = %else, %if
|
|
|
|
%value = phi i32 [ %if_value, %if ], [ %else_value, %else ]
|
|
|
|
store i32 %value, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind
|
|
|
|
declare { i1, i64 } @llvm.amdgcn.if(i1) #1
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind
|
|
|
|
declare { i1, i64 } @llvm.amdgcn.else(i64) #1
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind readnone
|
|
|
|
declare i64 @llvm.amdgcn.break(i64) #2
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind readnone
|
|
|
|
declare i64 @llvm.amdgcn.if.break(i1, i64) #2
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind readnone
|
|
|
|
declare i64 @llvm.amdgcn.else.break(i64, i64) #2
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind
|
|
|
|
declare i1 @llvm.amdgcn.loop(i64) #1
|
|
|
|
|
|
|
|
; Function Attrs: convergent nounwind
|
|
|
|
declare void @llvm.amdgcn.end.cf(i64) #1
|
|
|
|
|
|
|
|
attributes #0 = { "target-cpu"="gfx803" }
|
|
|
|
attributes #1 = { convergent nounwind }
|
|
|
|
attributes #2 = { convergent nounwind readnone }
|
|
|
|
|
|
|
|
!0 = !{}
|
|
|
|
!1 = !{i32 1}
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: multiple_mem_operands
|
|
|
|
|
|
|
|
# CHECK-LABEL: bb.3.done:
|
2019-05-01 06:08:23 +08:00
|
|
|
# CHECK: BUFFER_LOAD_DWORD_OFFEN killed $vgpr0, killed $sgpr8_sgpr9_sgpr10_sgpr11, $sgpr3, 0, 1, 1, 0, 0
|
2017-09-08 01:14:54 +08:00
|
|
|
|
|
|
|
name: multiple_mem_operands
|
[Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing
Summary:
This catches malformed mir files which specify alignment as log2 instead of pow2.
See https://reviews.llvm.org/D65945 for reference,
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: MatzeB, qcolombet, dschuff, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67433
llvm-svn: 371608
2019-09-11 19:16:48 +08:00
|
|
|
alignment: 1
|
2017-09-08 01:14:54 +08:00
|
|
|
exposesReturnsTwice: false
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
selected: false
|
|
|
|
tracksRegLiveness: true
|
|
|
|
registers:
|
|
|
|
liveins:
|
2018-02-01 06:04:26 +08:00
|
|
|
- { reg: '$sgpr0_sgpr1', virtual-reg: '' }
|
|
|
|
- { reg: '$sgpr3', virtual-reg: '' }
|
2017-09-08 01:14:54 +08:00
|
|
|
frameInfo:
|
|
|
|
isFrameAddressTaken: false
|
|
|
|
isReturnAddressTaken: false
|
|
|
|
hasStackMap: false
|
|
|
|
hasPatchPoint: false
|
|
|
|
stackSize: 65540
|
|
|
|
offsetAdjustment: 0
|
|
|
|
maxAlignment: 4
|
|
|
|
adjustsStack: false
|
|
|
|
hasCalls: false
|
|
|
|
stackProtector: ''
|
|
|
|
maxCallFrameSize: 0
|
|
|
|
hasOpaqueSPAdjustment: false
|
|
|
|
hasVAStart: false
|
|
|
|
hasMustTailInVarArgFunc: false
|
|
|
|
savePoint: ''
|
|
|
|
restorePoint: ''
|
|
|
|
fixedStack:
|
2019-06-17 17:13:29 +08:00
|
|
|
- { id: 0, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,
|
2017-09-08 01:14:54 +08:00
|
|
|
isImmutable: false, isAliased: false, callee-saved-register: '' }
|
|
|
|
stack:
|
|
|
|
- { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
|
2019-06-17 17:13:29 +08:00
|
|
|
stack-id: default, callee-saved-register: '', local-offset: 0,
|
2018-04-26 02:58:06 +08:00
|
|
|
debug-info-variable: '', debug-info-expression: '',
|
|
|
|
debug-info-location: '' }
|
2017-09-08 01:14:54 +08:00
|
|
|
- { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
|
2019-06-17 17:13:29 +08:00
|
|
|
alignment: 4, stack-id: default, callee-saved-register: '', local-offset: 32768,
|
2018-04-26 02:58:06 +08:00
|
|
|
debug-info-variable: '', debug-info-expression: '',
|
|
|
|
debug-info-location: '' }
|
2017-09-08 01:14:54 +08:00
|
|
|
constants:
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
successors: %bb.1.if(0x30000000), %bb.2.else(0x50000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr0_sgpr1, $sgpr3
|
|
|
|
|
2019-05-01 06:08:23 +08:00
|
|
|
$sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 44, 0, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(4)* undef`)
|
2018-02-01 06:04:26 +08:00
|
|
|
$sgpr8 = S_MOV_B32 &SCRATCH_RSRC_DWORD0, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11
|
2019-05-01 06:08:23 +08:00
|
|
|
$sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM $sgpr0_sgpr1, 36, 0, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(4)* undef`)
|
2018-02-01 06:04:26 +08:00
|
|
|
$sgpr9 = S_MOV_B32 &SCRATCH_RSRC_DWORD1, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11
|
|
|
|
$sgpr10 = S_MOV_B32 4294967295, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11
|
|
|
|
$sgpr11 = S_MOV_B32 15204352, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11
|
|
|
|
$vgpr0 = V_MOV_B32_e32 1, implicit $exec
|
[AMDGPU] Extend buffer intrinsics with swizzling
Summary:
Extend cachepolicy operand in the new VMEM buffer intrinsics
to supply information whether the buffer data is swizzled.
Also, propagate this information to MIR.
Intrinsics updated:
int_amdgcn_raw_buffer_load
int_amdgcn_raw_buffer_load_format
int_amdgcn_raw_buffer_store
int_amdgcn_raw_buffer_store_format
int_amdgcn_raw_tbuffer_load
int_amdgcn_raw_tbuffer_store
int_amdgcn_struct_buffer_load
int_amdgcn_struct_buffer_load_format
int_amdgcn_struct_buffer_store
int_amdgcn_struct_buffer_store_format
int_amdgcn_struct_tbuffer_load
int_amdgcn_struct_tbuffer_store
Furthermore, disable merging of VMEM buffer instructions
in SI Load/Store optimizer, if the "swizzled" bit on the instruction
is on.
The default value of the bit is 0, meaning that data in buffer
is linear and buffer instructions can be merged.
There is no difference in the generated code with this commit.
However, in the future it will be expected that front-ends
use buffer intrinsics with correct "swizzled" bit set.
Reviewers: arsenm, nhaehnle, tpr
Reviewed By: nhaehnle
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, arphaman, jfb, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68200
llvm-svn: 373491
2019-10-03 01:22:36 +08:00
|
|
|
BUFFER_STORE_DWORD_OFFSET killed $vgpr0, $sgpr8_sgpr9_sgpr10_sgpr11, $sgpr3, 4, 0, 0, 0, 0, 0, implicit $exec :: (store 4 into %ir.scratchptr01)
|
2017-09-08 01:14:54 +08:00
|
|
|
S_WAITCNT 127
|
2018-02-01 06:04:26 +08:00
|
|
|
S_CMP_LG_U32 killed $sgpr2, 0, implicit-def $scc
|
2017-09-08 01:14:54 +08:00
|
|
|
S_WAITCNT 3855
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr0 = V_MOV_B32_e32 2, implicit $exec
|
|
|
|
$vgpr1 = V_MOV_B32_e32 32772, implicit $exec
|
[AMDGPU] Extend buffer intrinsics with swizzling
Summary:
Extend cachepolicy operand in the new VMEM buffer intrinsics
to supply information whether the buffer data is swizzled.
Also, propagate this information to MIR.
Intrinsics updated:
int_amdgcn_raw_buffer_load
int_amdgcn_raw_buffer_load_format
int_amdgcn_raw_buffer_store
int_amdgcn_raw_buffer_store_format
int_amdgcn_raw_tbuffer_load
int_amdgcn_raw_tbuffer_store
int_amdgcn_struct_buffer_load
int_amdgcn_struct_buffer_load_format
int_amdgcn_struct_buffer_store
int_amdgcn_struct_buffer_store_format
int_amdgcn_struct_tbuffer_load
int_amdgcn_struct_tbuffer_store
Furthermore, disable merging of VMEM buffer instructions
in SI Load/Store optimizer, if the "swizzled" bit on the instruction
is on.
The default value of the bit is 0, meaning that data in buffer
is linear and buffer instructions can be merged.
There is no difference in the generated code with this commit.
However, in the future it will be expected that front-ends
use buffer intrinsics with correct "swizzled" bit set.
Reviewers: arsenm, nhaehnle, tpr
Reviewed By: nhaehnle
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, arphaman, jfb, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68200
llvm-svn: 373491
2019-10-03 01:22:36 +08:00
|
|
|
BUFFER_STORE_DWORD_OFFEN killed $vgpr0, killed $vgpr1, $sgpr8_sgpr9_sgpr10_sgpr11, $sgpr3, 0, 0, 0, 0, 0, 0, implicit $exec :: (store 4 into %ir.scratchptr12)
|
2018-02-01 06:04:26 +08:00
|
|
|
S_CBRANCH_SCC0 %bb.1.if, implicit killed $scc
|
2017-09-08 01:14:54 +08:00
|
|
|
|
|
|
|
bb.2.else:
|
|
|
|
successors: %bb.3.done(0x80000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr0_sgpr1, $sgpr4_sgpr5, $sgpr3, $sgpr8_sgpr9_sgpr10_sgpr11
|
2017-09-08 01:14:54 +08:00
|
|
|
|
2019-05-01 06:08:23 +08:00
|
|
|
$sgpr0 = S_LOAD_DWORD_IMM killed $sgpr0_sgpr1, 52, 0, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(4)* undef`)
|
2017-09-08 01:14:54 +08:00
|
|
|
S_WAITCNT 3855
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr0 = V_MOV_B32_e32 32772, implicit $exec
|
2017-09-08 01:14:54 +08:00
|
|
|
S_BRANCH %bb.3.done
|
|
|
|
|
|
|
|
bb.1.if:
|
|
|
|
successors: %bb.3.done(0x80000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr0_sgpr1, $sgpr4_sgpr5, $sgpr3, $sgpr8_sgpr9_sgpr10_sgpr11
|
2017-09-08 01:14:54 +08:00
|
|
|
|
2019-05-01 06:08:23 +08:00
|
|
|
$sgpr0 = S_LOAD_DWORD_IMM killed $sgpr0_sgpr1, 48, 0, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(4)* undef`)
|
2017-09-08 01:14:54 +08:00
|
|
|
S_WAITCNT 3855
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr0 = V_MOV_B32_e32 4, implicit $exec
|
2017-09-08 01:14:54 +08:00
|
|
|
|
|
|
|
bb.3.done:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr3, $sgpr4_sgpr5, $sgpr8_sgpr9_sgpr10_sgpr11, $vgpr0, $sgpr0
|
2017-09-08 01:14:54 +08:00
|
|
|
|
|
|
|
S_WAITCNT 127
|
2018-02-01 06:04:26 +08:00
|
|
|
$sgpr0 = S_LSHL_B32 killed $sgpr0, 2, implicit-def dead $scc
|
2020-07-14 21:18:36 +08:00
|
|
|
$vgpr0 = V_ADD_CO_U32_e32 killed $sgpr0, killed $vgpr0, implicit-def dead $vcc, implicit $exec
|
[AMDGPU] Extend buffer intrinsics with swizzling
Summary:
Extend cachepolicy operand in the new VMEM buffer intrinsics
to supply information whether the buffer data is swizzled.
Also, propagate this information to MIR.
Intrinsics updated:
int_amdgcn_raw_buffer_load
int_amdgcn_raw_buffer_load_format
int_amdgcn_raw_buffer_store
int_amdgcn_raw_buffer_store_format
int_amdgcn_raw_tbuffer_load
int_amdgcn_raw_tbuffer_store
int_amdgcn_struct_buffer_load
int_amdgcn_struct_buffer_load_format
int_amdgcn_struct_buffer_store
int_amdgcn_struct_buffer_store_format
int_amdgcn_struct_tbuffer_load
int_amdgcn_struct_tbuffer_store
Furthermore, disable merging of VMEM buffer instructions
in SI Load/Store optimizer, if the "swizzled" bit on the instruction
is on.
The default value of the bit is 0, meaning that data in buffer
is linear and buffer instructions can be merged.
There is no difference in the generated code with this commit.
However, in the future it will be expected that front-ends
use buffer intrinsics with correct "swizzled" bit set.
Reviewers: arsenm, nhaehnle, tpr
Reviewed By: nhaehnle
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, arphaman, jfb, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68200
llvm-svn: 373491
2019-10-03 01:22:36 +08:00
|
|
|
$vgpr0 = BUFFER_LOAD_DWORD_OFFEN killed $vgpr0, killed $sgpr8_sgpr9_sgpr10_sgpr11, $sgpr3, 0, 0, 0, 0, 0, 0, implicit $exec :: (non-temporal load 4 from %ir.else_ptr), (non-temporal load 4 from %ir.if_ptr)
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr1 = V_MOV_B32_e32 $sgpr4, implicit $exec, implicit-def $vgpr1_vgpr2, implicit $sgpr4_sgpr5
|
|
|
|
$vgpr2 = V_MOV_B32_e32 killed $sgpr5, implicit $exec, implicit $sgpr4_sgpr5, implicit $exec
|
2017-09-08 01:14:54 +08:00
|
|
|
S_WAITCNT 3952
|
2019-05-01 06:08:23 +08:00
|
|
|
FLAT_STORE_DWORD killed $vgpr1_vgpr2, killed $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4 into %ir.out)
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 17:52:58 +08:00
|
|
|
S_ENDPGM 0
|
2017-09-08 01:14:54 +08:00
|
|
|
|
|
|
|
...
|