[PATCH] D103743: [RISCV] Optimize bitwise and with constant for the Zbs extension

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 5 12:38:54 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoB.td:140
+  // The immediate must have exactly two bits clear.
+  uint64_t I = static_cast<uint64_t>(~N->getSExtValue());
+  return countPopulation(I) == 2;
----------------
What if the type is i32 and bit 31 is one of the clear bits. This sign extend won't handle that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103743



More information about the llvm-commits mailing list