[PATCH] D148716: [AMDGPU] NFC. Refactor GISel for cmp intrinsics
Joe Nash via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 19 08:34:06 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG05d04a0180c7: [AMDGPU] NFC. Refactor GISel for cmp intrinsics (authored by Joe_Nash).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148716/new/
https://reviews.llvm.org/D148716
Files:
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
@@ -1291,27 +1291,26 @@
if (Opcode == -1)
return false;
- MachineInstr *SelectedMI;
- if (CmpInst::isFPPredicate(Pred)) {
- MachineOperand &LHS = I.getOperand(2);
- MachineOperand &RHS = I.getOperand(3);
- auto [Src0, Src0Mods] = selectVOP3ModsImpl(LHS);
- auto [Src1, Src1Mods] = selectVOP3ModsImpl(RHS);
- Register Src0Reg =
- copyToVGPRIfSrcFolded(Src0, Src0Mods, LHS, &I, /*ForceVGPR*/ true);
- Register Src1Reg =
- copyToVGPRIfSrcFolded(Src1, Src1Mods, RHS, &I, /*ForceVGPR*/ true);
- SelectedMI = BuildMI(*BB, &I, DL, TII.get(Opcode), Dst)
- .addImm(Src0Mods)
- .addReg(Src0Reg)
- .addImm(Src1Mods)
- .addReg(Src1Reg)
- .addImm(0); // clamp
- } else {
- SelectedMI = BuildMI(*BB, &I, DL, TII.get(Opcode), Dst)
- .add(I.getOperand(2))
- .add(I.getOperand(3));
- }
+ MachineInstrBuilder SelectedMI;
+ MachineOperand &LHS = I.getOperand(2);
+ MachineOperand &RHS = I.getOperand(3);
+ auto [Src0, Src0Mods] = selectVOP3ModsImpl(LHS);
+ auto [Src1, Src1Mods] = selectVOP3ModsImpl(RHS);
+ Register Src0Reg =
+ copyToVGPRIfSrcFolded(Src0, Src0Mods, LHS, &I, /*ForceVGPR*/ true);
+ Register Src1Reg =
+ copyToVGPRIfSrcFolded(Src1, Src1Mods, RHS, &I, /*ForceVGPR*/ true);
+ SelectedMI = BuildMI(*BB, &I, DL, TII.get(Opcode), Dst);
+ if (AMDGPU::hasNamedOperand(Opcode, AMDGPU::OpName::src0_modifiers))
+ SelectedMI.addImm(Src0Mods);
+ SelectedMI.addReg(Src0Reg);
+ if (AMDGPU::hasNamedOperand(Opcode, AMDGPU::OpName::src1_modifiers))
+ SelectedMI.addImm(Src1Mods);
+ SelectedMI.addReg(Src1Reg);
+ if (AMDGPU::hasNamedOperand(Opcode, AMDGPU::OpName::clamp))
+ SelectedMI.addImm(0); // clamp
+ if (AMDGPU::hasNamedOperand(Opcode, AMDGPU::OpName::op_sel))
+ SelectedMI.addImm(0); // op_sel
RBI.constrainGenericRegister(Dst, *TRI.getBoolRC(), *MRI);
if (!constrainSelectedInstRegOperands(*SelectedMI, TII, TRI, RBI))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148716.514969.patch
Type: text/x-patch
Size: 2288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230419/6d132baf/attachment.bin>
More information about the llvm-commits
mailing list