[PATCH] D76500: GlobalISel: Lower funnel shifts

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 09:44:41 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:4196-4197
+  auto CCTy = Ty.changeElementSize(1);
+  // If (Z % BW == 0), then the opposite direction shift is shift-by-bitwidth,
+  // and that is undefined. We must compare and select to avoid UB.
+
----------------
It would be slicker to implement `(X << (BW - (Z % BW)))` as `(X << 1 << ((BW - 1) - (Z % BW)))`.


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

https://reviews.llvm.org/D76500





More information about the llvm-commits mailing list