Skip to content

Commit 5fe4d5e

Browse files
committed
Restore SGPR_LO16 handling
1 parent 1d9fb61 commit 5fe4d5e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,13 @@ void SIFoldOperandsImpl::foldOperand(
12601260
return;
12611261

12621262
const TargetRegisterClass *DestRC = TRI->getRegClassForReg(*MRI, DestReg);
1263+
// Allow immediates COPYd into sgpr_lo16 to be further folded while
1264+
// still being legal if not further folded
1265+
if (DestRC == &AMDGPU::SGPR_LO16RegClass) {
1266+
assert(ST->useRealTrue16Insts());
1267+
MRI->setRegClass(DestReg, &AMDGPU::SGPR_32RegClass);
1268+
DestRC = &AMDGPU::SGPR_32RegClass;
1269+
}
12631270

12641271
// In order to fold immediates into copies, we need to change the copy to a
12651272
// MOV. Find a compatible mov instruction with the value.
@@ -1298,14 +1305,6 @@ void SIFoldOperandsImpl::foldOperand(
12981305
UseMI->setDesc(MovDesc);
12991306

13001307
if (MovOp == AMDGPU::V_MOV_B16_t16_e64) {
1301-
// Allow immediates COPYd into sgpr_lo16 to be further folded while
1302-
// still being legal if not further folded
1303-
if (DestRC == &AMDGPU::SGPR_LO16RegClass) {
1304-
assert(ST->useRealTrue16Insts());
1305-
MRI->setRegClass(DestReg, &AMDGPU::SGPR_32RegClass);
1306-
DestRC = &AMDGPU::SGPR_32RegClass;
1307-
}
1308-
13091308
const auto &SrcOp = UseMI->getOperand(UseOpIdx);
13101309
MachineOperand NewSrcOp(SrcOp);
13111310
MachineFunction *MF = UseMI->getParent()->getParent();

0 commit comments

Comments
 (0)