Move the (add (umax X, C), -C) --> (usubsat X, C) X86 combine into generic DAGCombiner
First of a number of saturated arithmetic folds that can be moved out of X86-specific code for PR40111.
Paths
| Differential D57754
[DAGCombiner] (add (umax X, C), -C) --> (usubsat X, C) (PR40111) ClosedPublic Authored by RKSimon on Feb 5 2019, 7:30 AM.
Details Summary Move the (add (umax X, C), -C) --> (usubsat X, C) X86 combine into generic DAGCombiner First of a number of saturated arithmetic folds that can be moved out of X86-specific code for PR40111.
Diff Detail
Event Timeline
This revision is now accepted and ready to land.Feb 6 2019, 11:54 AM Closed by commit rL353457: [DAGCombiner] (add (umax X, C), -C) --> (usubsat X, C) (PR40111) (authored by RKSimon). · Explain WhyFeb 7 2019, 12:14 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 185521 lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/X86/X86ISelLowering.cpp
|
I'm not familiar with the nuances of the legality checking here, but wondering if using the hasOperation(ISD::USUBSAT, VT) helper would make more sense? If usubsat is not legal or custom, then the created usubsat is going to be expanded back into umax+add during legalization again anyway.