2019-12-09 19:37:14 +08:00
|
|
|
# RUN: llc -march=amdgcn -run-pass=si-memory-legalizer %s -o - | FileCheck %s
|
2017-07-22 05:19:23 +08:00
|
|
|
|
|
|
|
--- |
|
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x() #0
|
|
|
|
|
|
|
|
define amdgpu_kernel void @atomic_max_i32_noret(
|
|
|
|
i32 addrspace(1)* %out,
|
|
|
|
i32 addrspace(1)* addrspace(1)* %in,
|
|
|
|
i32 addrspace(1)* %x,
|
|
|
|
i32 %y) #1 {
|
|
|
|
%tid = call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%idxprom = sext i32 %tid to i64
|
|
|
|
%tid.gep = getelementptr i32 addrspace(1)*, i32 addrspace(1)* addrspace(1)* %in, i64 %idxprom
|
|
|
|
%ptr = load volatile i32 addrspace(1)*, i32 addrspace(1)* addrspace(1)* %tid.gep
|
|
|
|
%xor = xor i32 %tid, 1
|
|
|
|
%cmp = icmp ne i32 %xor, 0
|
|
|
|
%1 = call { i1, i64 } @llvm.amdgcn.if(i1 %cmp)
|
|
|
|
%2 = extractvalue { i1, i64 } %1, 0
|
|
|
|
%3 = extractvalue { i1, i64 } %1, 1
|
|
|
|
br i1 %2, label %atomic, label %exit
|
|
|
|
|
|
|
|
atomic: ; preds = %0
|
|
|
|
%gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 100
|
|
|
|
%ret = atomicrmw max i32 addrspace(1)* %gep, i32 %y seq_cst
|
|
|
|
br label %exit
|
|
|
|
|
|
|
|
exit: ; preds = %atomic, %0
|
|
|
|
call void @llvm.amdgcn.end.cf(i64 %3)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare { i1, i64 } @llvm.amdgcn.if(i1)
|
|
|
|
|
|
|
|
declare void @llvm.amdgcn.end.cf(i64)
|
|
|
|
|
2019-12-09 19:37:14 +08:00
|
|
|
attributes #0 = { nounwind readnone }
|
|
|
|
attributes #1 = { nounwind "target-cpu"="gfx803" }
|
2017-07-22 05:19:23 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: atomic_max_i32_noret
|
|
|
|
|
|
|
|
# CHECK-LABEL: bb.1.atomic:
|
|
|
|
# CHECK: BUFFER_ATOMIC_SMAX_ADDR64
|
|
|
|
# CHECK-NEXT: S_WAITCNT 3952
|
|
|
|
# CHECK-NEXT: BUFFER_WBINVL1_VOL
|
|
|
|
|
|
|
|
name: atomic_max_i32_noret
|
[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-07-22 05:19:23 +08:00
|
|
|
exposesReturnsTwice: false
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
selected: false
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
2018-02-01 06:04:26 +08:00
|
|
|
- { reg: '$sgpr0_sgpr1' }
|
|
|
|
- { reg: '$vgpr0' }
|
2017-07-22 05:19:23 +08:00
|
|
|
frameInfo:
|
|
|
|
isFrameAddressTaken: false
|
|
|
|
isReturnAddressTaken: false
|
|
|
|
hasStackMap: false
|
|
|
|
hasPatchPoint: false
|
|
|
|
stackSize: 0
|
|
|
|
offsetAdjustment: 0
|
|
|
|
maxAlignment: 0
|
|
|
|
adjustsStack: false
|
|
|
|
hasCalls: false
|
|
|
|
maxCallFrameSize: 0
|
|
|
|
hasOpaqueSPAdjustment: false
|
|
|
|
hasVAStart: false
|
|
|
|
hasMustTailInVarArgFunc: false
|
|
|
|
body: |
|
|
|
|
bb.0 (%ir-block.0):
|
|
|
|
successors: %bb.1.atomic(0x40000000), %bb.2.exit(0x40000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $vgpr0, $sgpr0_sgpr1
|
2018-09-10 10:54:25 +08:00
|
|
|
|
2021-02-09 08:36:10 +08:00
|
|
|
$sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM $sgpr0_sgpr1, 11, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(4)* undef`)
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr1 = V_ASHRREV_I32_e32 31, $vgpr0, implicit $exec
|
2021-01-08 02:56:02 +08:00
|
|
|
$vgpr1_vgpr2 = V_LSHL_B64_e64 $vgpr0_vgpr1, 3, implicit $exec
|
2018-02-01 06:04:26 +08:00
|
|
|
$sgpr7 = S_MOV_B32 61440
|
|
|
|
$sgpr6 = S_MOV_B32 0
|
2017-07-22 05:19:23 +08:00
|
|
|
S_WAITCNT 127
|
2021-02-09 08:36:10 +08:00
|
|
|
$vgpr1_vgpr2 = BUFFER_LOAD_DWORDX2_ADDR64 killed $vgpr1_vgpr2, $sgpr4_sgpr5_sgpr6_sgpr7, 0, 0, 0, 0, 0, implicit $exec :: (volatile load 8 from %ir.tid.gep)
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr0 = V_XOR_B32_e32 1, killed $vgpr0, implicit $exec
|
|
|
|
V_CMP_NE_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
|
|
|
|
$sgpr2_sgpr3 = S_AND_SAVEEXEC_B64 killed $vcc, implicit-def $exec, implicit-def $scc, implicit $exec
|
|
|
|
$sgpr2_sgpr3 = S_XOR_B64 $exec, killed $sgpr2_sgpr3, implicit-def dead $scc
|
2021-02-25 09:19:37 +08:00
|
|
|
S_CBRANCH_EXECZ %bb.2.exit, implicit $exec
|
2018-09-10 10:54:25 +08:00
|
|
|
|
2017-07-22 05:19:23 +08:00
|
|
|
bb.1.atomic:
|
|
|
|
successors: %bb.2.exit(0x80000000)
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr4_sgpr5_sgpr6_sgpr7:0x0000000C, $sgpr0_sgpr1, $sgpr2_sgpr3, $vgpr1_vgpr2_vgpr3_vgpr4:0x00000003
|
2018-09-10 10:54:25 +08:00
|
|
|
|
2021-02-09 08:36:10 +08:00
|
|
|
$sgpr0 = S_LOAD_DWORD_IMM killed $sgpr0_sgpr1, 15, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(4)* undef`)
|
2018-02-01 06:04:26 +08:00
|
|
|
dead $vgpr0 = V_MOV_B32_e32 -1, implicit $exec
|
|
|
|
dead $vgpr0 = V_MOV_B32_e32 61440, implicit $exec
|
|
|
|
$sgpr4_sgpr5 = S_MOV_B64 0
|
2017-07-22 05:19:23 +08:00
|
|
|
S_WAITCNT 127
|
2018-02-01 06:04:26 +08:00
|
|
|
$vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec
|
2017-07-22 05:19:23 +08:00
|
|
|
S_WAITCNT 3952
|
2019-03-26 04:50:21 +08:00
|
|
|
BUFFER_ATOMIC_SMAX_ADDR64 killed $vgpr0, killed $vgpr1_vgpr2, killed $sgpr4_sgpr5_sgpr6_sgpr7, 0, 400, 0, implicit $exec :: (volatile load syncscope("one-as") seq_cst 4 from %ir.gep)
|
2018-09-10 10:54:25 +08:00
|
|
|
|
2017-07-22 05:19:23 +08:00
|
|
|
bb.2.exit:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $sgpr2_sgpr3
|
2017-07-22 05:19:23 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
$exec = S_OR_B64 $exec, killed $sgpr2_sgpr3, implicit-def $scc
|
[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-07-22 05:19:23 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
|