[PATCH] D125642: [X86] Attempt to fold EFLAGS into X86ISD::ADD/SUB ops

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 00:56:50 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:52615
 
-  return SDValue();
+  return combineAddOrSubToADCOrSBB(IsSub, DL, VT, LHS, RHS, DAG);
 }
----------------
Since the ADD/SUB that is being replaced has flag users that might use the carry flag. Do all of the combines in combineAddOrSubToADCOrSBB produce the same value for the carry flag as the original ADD/SUB.

I'm not sure this one does
```
-1 + SETAE --> -1 + (!CF) --> CF ? -1 : 0 --> SBB %eax, %eax
```

But I admit I'm having a hard time thinking about it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125642/new/

https://reviews.llvm.org/D125642



More information about the llvm-commits mailing list