This is an archive of the discontinued LLVM Phabricator instance.

[X86] combineCarryThroughADD - add support for X86::COND_A commutations (PR24545)
ClosedPublic

Authored by RKSimon on Jan 26 2019, 5:06 AM.

Details

Summary

As discussed on PR24545, we should try to commute X86::COND_A 'icmp ugt' cases to X86::COND_B 'icmp ult' to more optimally bind the carry flag output to a SBB instruction.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Jan 26 2019, 5:06 AM
This revision is now accepted and ready to land.Jan 26 2019, 10:08 AM
This revision was automatically updated to reflect the committed changes.
craig.topper added inline comments.Jan 26 2019, 12:28 PM
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
34904

Do we need to make sure the data output of the subtract doesn't have any users? CarryOp1.hasOneUse() will only check the flag result has one use. CarryOp1->hasOneUse() will check that the entire node only has one use.

RKSimon added inline comments.Jan 26 2019, 1:11 PM
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
34904

I can do that - interestingly the code in combineAddOrSubToADCOrSBB (where I got this from) doesn't do this either