[llvm] [GlobalIsel] Combine select of binops (PR #76763)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 21:22:49 PST 2024


================
@@ -558,6 +558,109 @@ class GVecReduce : public GenericMachineInstr {
   }
 };
 
+// Represents a binary operation, i.e, x = y op z.
+class GBinOp : public GenericMachineInstr {
+public:
+  Register getLHSReg() const { return getReg(1); }
+  Register getRHSReg() const { return getReg(2); }
+
+  static bool classof(const MachineInstr *MI) {
+    switch (MI->getOpcode()) {
----------------
arsenm wrote:

Could you implement this in terms of GIntBinOp::classof and GFBinOp::classof to avoid listing the opcodes in multiple places?

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


More information about the llvm-commits mailing list