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

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 7 20:19:06 PDT 2022


SixWeining added a comment.

Other parts LGTM.



================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:154
 
+SDValue LoongArchTargetLowering::lowerBSWAP32(SDValue Op,
+                                              SelectionDAG &DAG) const {
----------------
Another approach:
```
let Predicates = [IsLA32] in {
def : Pat<(bswap GPR:$rj), (ROTRI_W (REVB_2H GPR:$rj), 16)>;
}
```

I'm not sure which approach is better. But this one uses less code.


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