[PATCH] D132718: [LoongArch] Combine add + shl to alsl.[w/d/wu]

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 01:25:40 PDT 2022


xen0n added a comment.

I mean, it should be possible to test `alsl.* xx, xx, xx, N` where N is 1, 2 or 4 right? Currently only 3 is being tested.



================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:745
+          (ALSL_D GPR:$rj, GPR:$rk, uimm2_plus1:$imm2)>;
+def : Pat<(loongarch_bstrpick (add GPR:$rk, (shl GPR:$rj, uimm2_plus1:$imm2)),
+                              (i64 31), (i64 0)),
----------------
gonglingqin wrote:
> xen0n wrote:
> > This feels a bit weird, could a more generic node be used here instead of the rather concrete `bstrpick` one?
> Since `zero_extend` will be converted to `and`, and the `and` node generates `LoongArchISD::BSTRPICK` by combining before the instruction selection process. Therefore, if common nodes are used for matching, optimization needs to be added during the Combine process, which requires more code. So tblgen was chosen to simplify the code.
Okay that explains things. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132718



More information about the llvm-commits mailing list