[PATCH] D131352: [LoongArch] Add codegen support for bswap

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 7 19:09:59 PDT 2022


xen0n added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:68
 
+  // LA32 does not natively support any of the bswap ops.
+  if (Subtarget.is64Bit()) {
----------------
xen0n wrote:
> xen0n wrote:
> > SixWeining wrote:
> > > As [[ https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-Vol1-EN/basic-integer-instructions/overview-of-basic-integer-instructions.adoc#overview-of-basic-integer-instructions | Table 1 ]] described, `revb.2h` is available on LA32.
> > > So for `i16`, we can use it.
> > I looked at the original document《龙芯架构 32 位精简版参考手册》 which doesn't contain this instruction, maybe it's because it's actually describing the LA32 Primary ISA? But apparently it described way more instructions than the tiny subset suitable for university courses.
> > 
> > I'll change anyway. Thanks for the fact checking.
> Although it's really weird that `REVB.W` isn't being listed, even though it doesn't involve any operation wider than 32 bits... Maybe there are hardware implementation concerns but I'm not a HW designer so my intuition can fail me. Anyway `rotri.w` works.
> Although it's really weird that REVB.W isn't being listed

My bad; there isn't `REVB.W` but only `REVB.2W`. LoongArch is not orthogonal... (many swear words omitted)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131352



More information about the llvm-commits mailing list