[PATCH] D132482: RISCV: permit unaligned nop-slide padding emission

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 08:34:15 PDT 2022


compnerd marked 6 inline comments as done.
compnerd added inline comments.


================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp:369
+  // The canonical nop on RVC is c.nop.
+  if (Count % 4 == 2) {
+    OS.write(STI->getFeatureBits()[RISCV::FeatureStdExtC] ? "\x01\0" : "\0\0",
----------------
luismarques wrote:
> Nit: given the earlier adjustment, isn't this the same as `if (Count % 4)`? Maybe your way is clearer anyway...
Yes, given the previous `% 2`, it should only ever be 0, 2, which means that it is equivalent to `Count % 4`.  The reason for the 2 here is to be explicit (because I am not always quick enough to immediately spot those constraints) that we are guaranteed that the RVC_NOP will fit.  If people think that this is too verbose, I am fine with removing the `== 2.


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

https://reviews.llvm.org/D132482



More information about the llvm-commits mailing list