[llvm] [X86] Convert FP compares split by a nested logic op to FP logic (PR #226222)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 09:48:08 PDT 2026


================
@@ -52643,6 +52645,27 @@ static SDValue convertIntLogicToFPLogic(unsigned Opc, const SDLoc &DL, EVT VT,
   assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
          "Unexpected bit opcode");
 
+  // Look through a single-use inner logic op to pair up two FP compares that
+  // it separates, e.g. by an integer compare. The recursive call only sees
+  // SETCC operands, so this is limited to one level:
+  // logic (logic (setcc X), Y), (setcc Z) -->
+  // logic (logic (setcc X), (setcc Z)), Y
+  if (VT == MVT::i1) {
+    if (N1.getOpcode() == Opc)
----------------
RKSimon wrote:

Can you simplify all this commutation matching with SDPatternMatch?

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


More information about the llvm-commits mailing list