[llvm] [X86][GlobalISel] Add instruction selection for G_SELECT (PR #70753)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 01:05:18 PDT 2023


================
@@ -1789,6 +1793,47 @@ bool X86InstructionSelector::selectMulDivRem(MachineInstr &I,
   return true;
 }
 
+bool X86InstructionSelector::selectSelect(MachineInstr &I,
+                                          MachineRegisterInfo &MRI,
+                                          MachineFunction &MF) const {
+  unsigned DstReg = I.getOperand(0).getReg();
+  BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(X86::TEST32rr))
+      .addReg(I.getOperand(1).getReg())
+      .addReg(I.getOperand(1).getReg());
+
----------------
tschuett wrote:

Amara mentioned it in the FCMP PR:
```
auto &Select = cast<GSelect>(I);
```
It will give you access to all the Registers.

https://github.com/llvm/llvm-project/pull/70753


More information about the llvm-commits mailing list