[PATCH] D96413: [DAG] Move basic USUBSAT pattern matches from X86 to DAGCombine

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 19:45:38 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/test/CodeGen/AArch64/usub_sat.ll:35
+; CHECK-NEXT:    subs w8, w8, w1, uxth
+; CHECK-NEXT:    csel w0, wzr, w8, lo
 ; CHECK-NEXT:    ret
----------------
nikic wrote:
> Why are tests that directly use usub.sat intrinsics affected by this? Are we doing something weird like first expanding them to min/max sub and then combining them back to usubsat on the extended type?
I think type legalization expands it when it promotes the type. For USUBSAT, the expansion isn't necessary. Promoting the operands by zero extending would have been enough since the saturating value is 0 so is not affected by the promoted type. This is different than UADDSAT where the saturation value is UINT_MAX of the original type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96413/new/

https://reviews.llvm.org/D96413



More information about the llvm-commits mailing list