[PATCH] D83964: GlobalISel: Augment addsat/subsat lowering with an optional type

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 04:03:19 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:5356-5365
     // sadd.sat(a, b) ->
     //   hi = 0x7fffffff - smax(a, 0)
     //   lo = 0x80000000 - smin(a, 0)
     //   a + smin(smax(lo, b), hi)
     // ssub.sat(a, b) ->
     //   lo = smax(a, -1) - 0x7fffffff
     //   hi = smin(a, -1) - 0x80000000
----------------
Surely we should take advantage of DoPromote to simplify this? You can do a normal add/sub and then clamp the result to MinVal and MaxVal.


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

https://reviews.llvm.org/D83964



More information about the llvm-commits mailing list