Followup to D56636, this time handling the UADDSAT case by expanding uadd.sat(a, b) to umin(a, ~b) + b.
For the cost model I'm assuming the vector not (pcmpeq idiom + pxor) has a cost of 1, not sure if that's alright.
Paths 
  |  Differential  D56869  
[CodeGen][X86] Expand UADDSAT to NOT+UMIN+ADD ClosedPublic Authored by nikic on Jan 17 2019, 11:33 AM. 
Details Summary Followup to D56636, this time handling the UADDSAT case by expanding uadd.sat(a, b) to umin(a, ~b) + b. For the cost model I'm assuming the vector not (pcmpeq idiom + pxor) has a cost of 1, not sure if that's alright. 
Diff Detail 
 Event TimelineComment Actions I'm currently traveling and won't be able to rebase until Monday. Feel free to rebase/commit this before then though. This revision is now accepted and ready to land.Jan 28 2019, 10:36 AM Closed by commit rL352409: [CodeGen][X86] Expand UADDSAT to NOT+UMIN+ADD (authored by nikic).  ·  Explain WhyJan 28 2019, 11:20 AM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 183918 llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
 llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
 llvm/trunk/test/Analysis/CostModel/X86/arith-usat.ll
 llvm/trunk/test/CodeGen/X86/uadd_sat.ll
 llvm/trunk/test/CodeGen/X86/uadd_sat_vec.ll
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||