[PATCH] D131378: [LoongArch] Add codegen support for bitreverse

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 03:03:41 PDT 2022


SixWeining added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:77
+  setOperationAction(ISD::BITREVERSE, MVT::i8, Custom);
+  setOperationAction(ISD::BITREVERSE, MVT::i16, Custom);
+  if (Subtarget.is64Bit()) {
----------------
How about leave it to legal and use bitrev.4b+srli.w/d. I'm not sure which is fast and better.


================
Comment at: llvm/test/CodeGen/LoongArch/bitreverse.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=loongarch32 --verify-machineinstrs < %s \
+; RUN:   | FileCheck %s --check-prefix=LA32
----------------
Nit: had better use `--`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131378



More information about the llvm-commits mailing list