@@ -5960,7 +5960,7 @@ adjustAllocatableRegClass(const GCNSubtarget &ST, const SIRegisterInfo &RI,
59605960  if  ((IsAllocatable || !ST.hasGFX90AInsts ()) &&
59615961      (((TID.mayLoad () || TID.mayStore ()) &&
59625962        !(TID.TSFlags  & SIInstrFlags::Spill)) ||
5963-        (TID.TSFlags  & ( SIInstrFlags::DS | SIInstrFlags:: MIMG) ))) {
5963+        (TID.TSFlags  & SIInstrFlags::MIMG))) {
59645964    switch  (RCID) {
59655965    case  AMDGPU::AV_32RegClassID:
59665966      RCID = AMDGPU::VGPR_32RegClassID;
@@ -5996,24 +5996,20 @@ const TargetRegisterClass *SIInstrInfo::getRegClass(const MCInstrDesc &TID,
59965996    return  nullptr ;
59975997  auto  RegClass = TID.operands ()[OpNum].RegClass ;
59985998  bool  IsAllocatable = false ;
5999-   if  (TID.TSFlags  & ( SIInstrFlags::DS | SIInstrFlags:: FLAT) ) {
5999+   if  (TID.TSFlags  & SIInstrFlags::FLAT) {
60006000    //  vdst and vdata should be both VGPR or AGPR, same for the DS instructions
60016001    //  with two data operands. Request register class constrained to VGPR only
60026002    //  of both operands present as Machine Copy Propagation can not check this
60036003    //  constraint and possibly other passes too.
60046004    // 
6005-     //  The check is limited to FLAT and DS because atomics in non-flat encoding
6006-     //  have their vdst and vdata tied to be the same register.
6007-     const  int  VDstIdx = AMDGPU::getNamedOperandIdx (TID.Opcode ,
6008-                                                    AMDGPU::OpName::vdst);
6009-     const  int  DataIdx = AMDGPU::getNamedOperandIdx (TID.Opcode ,
6010-         (TID.TSFlags  & SIInstrFlags::DS) ? AMDGPU::OpName::data0
6011-                                          : AMDGPU::OpName::vdata);
6012-     if  (DataIdx != -1 ) {
6013-       IsAllocatable = VDstIdx != -1  || AMDGPU::hasNamedOperand (
6014-                                            TID.Opcode , AMDGPU::OpName::data1);
6015-     }
6005+     //  The check is limited to FLAT because atomics in non-flat encoding have
6006+     //  their vdst and vdata tied to be the same register, and DS instructions
6007+     //  have separate instruction definitions with AGPR and VGPR operand lists.
6008+     IsAllocatable =
6009+         AMDGPU::hasNamedOperand (TID.Opcode , AMDGPU::OpName::vdata) &&
6010+         AMDGPU::hasNamedOperand (TID.Opcode , AMDGPU::OpName::vdst);
60166011  }
6012+ 
60176013  return  adjustAllocatableRegClass (ST, RI, TID, RegClass, IsAllocatable);
60186014}
60196015
0 commit comments