Skip to content

Commit 72bc052

Browse files
authored
[AMDGPU][True16][CodeGen] update wwm reg sorting check condition (#135053)
We currently just need to shift down 32bit wwm registers. Previous check condition mistakenly select 16bit registers in true16 mode. Update check condition to skip the 16bit register in wmm reg sorting
1 parent daa1e17 commit 72bc052

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

llvm/lib/Target/AMDGPU/SIFrameLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ void SIFrameLowering::determineCalleeSaves(MachineFunction &MF,
16501650
// are of 32-bit size. SIPreAllocateWWMRegs pass can add tuples into WWM
16511651
// reserved registers.
16521652
const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Reg);
1653-
if (TRI->getRegSizeInBits(*RC) > 32)
1653+
if (TRI->getRegSizeInBits(*RC) != 32)
16541654
continue;
16551655
SortedWWMVGPRs.push_back(Reg);
16561656
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2+
# RUN: llc -mtriple=amdgcn-- -mcpu=gfx1100 -mattr=+real-true16 -run-pass=prologepilog %s -o - | FileCheck -check-prefix=GCN %s
3+
4+
---
5+
name: wwm_reg_skip_sort_16bit
6+
tracksRegLiveness: true
7+
machineFunctionInfo:
8+
isEntryFunction: true
9+
body: |
10+
bb.0:
11+
; GCN-LABEL: name: wwm_reg_skip_sort_16bit
12+
; GCN: renamable $sgpr0 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
13+
; GCN-NEXT: $vgpr0 = IMPLICIT_DEF
14+
; GCN-NEXT: renamable $sgpr1 = V_READLANE_B32 $vgpr0, 31
15+
; GCN-NEXT: renamable $sgpr2 = S_MOV_B32 0
16+
; GCN-NEXT: undef $vgpr0_lo16 = V_CNDMASK_B16_t16_e64 0, 0, 0, killed $sgpr1, killed $sgpr2, 0, implicit $exec
17+
; GCN-NEXT: $exec_lo = EXIT_STRICT_WWM killed renamable $sgpr0
18+
; GCN-NEXT: early-clobber renamable $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec
19+
; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $vgpr1
20+
renamable $sgpr0 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
21+
$vgpr0 = IMPLICIT_DEF
22+
renamable $sgpr1 = V_READLANE_B32 $vgpr0, 31
23+
renamable $sgpr2 = S_MOV_B32 0
24+
undef $vgpr0_lo16 = V_CNDMASK_B16_t16_e64 0, 0, 0, killed $sgpr1, killed $sgpr2, 0, implicit $exec
25+
$exec_lo = EXIT_STRICT_WWM killed renamable $sgpr0
26+
early-clobber renamable $vgpr1 = V_MOV_B32_e32 $vgpr0, implicit $exec
27+
S_ENDPGM 0, implicit killed renamable $vgpr1
28+
...

0 commit comments

Comments
 (0)