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

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 00:59:30 PDT 2022


SixWeining accepted this revision.
SixWeining added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!



================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:88
+    setOperationAction(ISD::BITREVERSE, MVT::i32, Custom);
+    setOperationAction(ISD::BITREVERSE, MVT::i64, Legal);
+  } else {
----------------
xen0n wrote:
> SixWeining wrote:
> > `Legal` is default. So we can omit it. And then we can omit the braces after `if` and before `else` since the body is simple. See [[ https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements | the coding standard ]].
> > 
> > Same as below.
> Unfortunately this seems not to be the case. If I remove both `Legal` setting then the operation gets expanded instead. See `lib/CodeGen/TargetLoweringBase.cpp:839`, it defaults to `Expand`.
Oh. My bad. :)


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