[PATCH] D99283: [GlobalISel] Combine and (lshr x, cst), mask -> ubfx x, cst, width

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 11:08:23 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3914
+  LLT Ty = MRI.getType(LHS);
+  if (!isLegal({TargetOpcode::G_UBFX, {Ty}}))
+    return false;
----------------
The amounts could be a different type from the value, so I guess I'll need to fix that in the instruction definition


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3939
+  // LSB must fit within the register.
+  const unsigned Size = Ty.getSizeInBits();
+  if (static_cast<uint64_t>(LSBImm) >= Size)
----------------
getScalarSizeInBits


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

https://reviews.llvm.org/D99283



More information about the llvm-commits mailing list