Skip to content

Commit e38e5aa

Browse files
committed
Refactoring repeating opcodes.
1 parent 4d2b413 commit e38e5aa

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
@@ -5309,6 +5309,14 @@ static uint64_t getIdentityValueFor64BitWaveReduction(unsigned Opc) {
53095309
}
53105310
}
53115311

5312+
static bool is32bitWaveReduceOperation(unsigned Opc) {
5313+
return Opc == AMDGPU::S_MIN_U32 || Opc == AMDGPU::S_MIN_I32 ||
5314+
Opc == AMDGPU::S_MAX_U32 || Opc == AMDGPU::S_MAX_I32 ||
5315+
Opc == AMDGPU::S_ADD_I32 || Opc == AMDGPU::S_SUB_I32 ||
5316+
Opc == AMDGPU::S_AND_B32 || Opc == AMDGPU::S_OR_B32 ||
5317+
Opc == AMDGPU::S_XOR_B32;
5318+
}
5319+
53125320
static MachineBasicBlock *lowerWaveReduce(MachineInstr &MI,
53135321
MachineBasicBlock &BB,
53145322
const GCNSubtarget &ST,
@@ -5417,11 +5425,7 @@ static MachineBasicBlock *lowerWaveReduce(MachineInstr &MI,
54175425
// so that we will get the next active lane for next iteration.
54185426
MachineBasicBlock::iterator I = BB.end();
54195427
Register SrcReg = MI.getOperand(1).getReg();
5420-
bool is32BitOpc = (Opc == AMDGPU::S_MIN_U32 || Opc == AMDGPU::S_MIN_I32 ||
5421-
Opc == AMDGPU::S_MAX_U32 || Opc == AMDGPU::S_MAX_I32 ||
5422-
Opc == AMDGPU::S_ADD_I32 || Opc == AMDGPU::S_SUB_I32 ||
5423-
Opc == AMDGPU::S_AND_B32 || Opc == AMDGPU::S_OR_B32 ||
5424-
Opc == AMDGPU::S_XOR_B32);
5428+
bool is32BitOpc = is32bitWaveReduceOperation(Opc);
54255429

54265430
// Create Control flow for loop
54275431
// Split MI's Machine Basic block into For loop

0 commit comments

Comments
 (0)