[PATCH] D69398: [APInt} Add saturating left-shift ops

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 11:55:34 PDT 2019


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/unittests/ADT/APIntTest.cpp:1225
+  EXPECT_EQ(APInt(8, 255), APInt(8, 64).ushl_sat(APInt(8, 2)));
+  EXPECT_EQ(APInt(8, 255), APInt(8, 64).ushl_sat(APInt(8, -2)));
+
----------------
It's a bit weird that out-of-bounds shift amounts have well-defined behavior here, but as this is an existing behavior of shl_ov, I guess it makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69398





More information about the llvm-commits mailing list