Skip to content

Commit 7937af8

Browse files
committed
Refactoring repeating opcodes.
1 parent cae4732 commit 7937af8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5231,6 +5231,14 @@ static uint64_t getIdentityValueFor64BitWaveReduction(unsigned Opc) {
52315231
}
52325232
}
52335233

5234+
static bool is32bitWaveReduceOperation(unsigned Opc) {
5235+
return Opc == AMDGPU::S_MIN_U32 || Opc == AMDGPU::S_MIN_I32 ||
5236+
Opc == AMDGPU::S_MAX_U32 || Opc == AMDGPU::S_MAX_I32 ||
5237+
Opc == AMDGPU::S_ADD_I32 || Opc == AMDGPU::S_SUB_I32 ||
5238+
Opc == AMDGPU::S_AND_B32 || Opc == AMDGPU::S_OR_B32 ||
5239+
Opc == AMDGPU::S_XOR_B32;
5240+
}
5241+
52345242
static MachineBasicBlock *lowerWaveReduce(MachineInstr &MI,
52355243
MachineBasicBlock &BB,
52365244
const GCNSubtarget &ST,
@@ -5339,11 +5347,7 @@ static MachineBasicBlock *lowerWaveReduce(MachineInstr &MI,
53395347
// so that we will get the next active lane for next iteration.
53405348
MachineBasicBlock::iterator I = BB.end();
53415349
Register SrcReg = MI.getOperand(1).getReg();
5342-
bool is32BitOpc = (Opc == AMDGPU::S_MIN_U32 || Opc == AMDGPU::S_MIN_I32 ||
5343-
Opc == AMDGPU::S_MAX_U32 || Opc == AMDGPU::S_MAX_I32 ||
5344-
Opc == AMDGPU::S_ADD_I32 || Opc == AMDGPU::S_SUB_I32 ||
5345-
Opc == AMDGPU::S_AND_B32 || Opc == AMDGPU::S_OR_B32 ||
5346-
Opc == AMDGPU::S_XOR_B32);
5350+
bool is32BitOpc = is32bitWaveReduceOperation(Opc);
53475351

53485352
// Create Control flow for loop
53495353
// Split MI's Machine Basic block into For loop

0 commit comments

Comments
 (0)