We already use combineAddOrSubToADCOrSBB to fold extended EFLAGS results into ISD::ADD/SUB ops as X86ISD::ADC/SBB carry ops.
This patch extends this to also fold EFLAGS results with X86ISD::ADD/SUB ops
Paths
| Differential D125642
[X86] Attempt to fold EFLAGS into X86ISD::ADD/SUB ops ClosedPublic Authored by RKSimon on May 15 2022, 2:10 PM.
Details Summary We already use combineAddOrSubToADCOrSBB to fold extended EFLAGS results into ISD::ADD/SUB ops as X86ISD::ADC/SBB carry ops. This patch extends this to also fold EFLAGS results with X86ISD::ADD/SUB ops
Diff Detail
Event TimelineThis revision is now accepted and ready to land.May 16 2022, 12:32 AM
Comment Actions I can initially limit this to cases that create SBB $0, %REG patterns if you think it safer? This revision is now accepted and ready to land.May 16 2022, 11:54 PM This revision was landed with ongoing or failed builds.May 17 2022, 2:59 AM Closed by commit rGc64f5d44ad3b: [X86] Attempt to fold EFLAGS into X86ISD::ADD/SUB ops (authored by RKSimon). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 429979 llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/add-sub-bool.ll
llvm/test/CodeGen/X86/addcarry.ll
llvm/test/CodeGen/X86/combine-sbb.ll
llvm/test/CodeGen/X86/subcarry.ll
|
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
But I admit I'm having a hard time thinking about it.