Hi, this is follow-up patch for https://reviews.llvm.org/D25987 and http://lists.llvm.org/pipermail/llvm-dev/2017-May/113113.html.
The first patch adds tests for the new canonical psubus pattern.
The second patch adds backend support for this pattern.
The patch transforms canonical version of unsigned saturation, which is sub(max(a,b),a) or sub(a,min(a,b)) to special psubus insturuction on targets, which support it(8bit and 16bit uints).
There is also extra case handled, when right part of sub is 32 bit and can be truncated, using UMIN(this transformation was discussed in https://reviews.llvm.org/D25987).