[PATCH] D147368: [LoongArch] Optimize bitwise and with immediates

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 21:38:19 PDT 2023


benshi001 added inline comments.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/and.ll:288
 ; LA32:       # %bb.0:
 ; LA32-NEXT:    lu12i.w $a1, 255
 ; LA32-NEXT:    and $a0, $a0, $a1
----------------
This is not optimized, since `0xff000` can be composed by a single `lu12i.w`.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/and.ll:321
 ; LA32:       # %bb.0:
 ; LA32-NEXT:    lu12i.w $a1, 255
 ; LA32-NEXT:    and $a0, $a0, $a1
----------------
This is not optimized, since `0xff000` can be composed by a single `lu12i.w`.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/and.ll:339
 ; LA32-NEXT:    lu12i.w $a1, 15
 ; LA32-NEXT:    ori $a1, $a1, 4080
 ; LA32-NEXT:    and $a2, $a2, $a1
----------------
This is not optimized, since the constant is used twice.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/and.ll:369
 ; LA64:       # %bb.0:
 ; LA64-NEXT:    addi.w $a1, $zero, -31
 ; LA64-NEXT:    and $a0, $a0, $a1
----------------
This is not optimized, since the value `-31` can be composed by a single `ADDI.W`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147368



More information about the llvm-commits mailing list