[PATCH] D131231: [LoongArch] Add codegen support for ISD::ROTL and ISD::ROTR

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 03:30:59 PDT 2022


xen0n added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.h:38-39
 
+  ROTR_W,
+  ROTL_W,
+
----------------
Are you placing ROTR before ROTL because it's the native instruction? Because alphabetically it would be the opposite.

Not a big concern though.


================
Comment at: llvm/test/CodeGen/LoongArch/rotl-rotr.ll:5
+
+;; TODO: Add optimization to ISD::ROTL
+
----------------
Isn't N-bit left-rotates equivalent to `GRLen - N`-bit right-rotates? I think you can just transform ROTL to equivalent ROTR then get optimized for free. In other words, at instruction selection time there shouldn't be any ROTLs left around.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131231



More information about the llvm-commits mailing list