[PATCH] D154919: [LoongArch] Implement isSExtCheaperThanZExt

hev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 03:38:25 PDT 2023


hev added a comment.

Thanks.



================
Comment at: llvm/test/CodeGen/LoongArch/atomicrmw-uinc-udec-wrap.ll:308
 ; LA64-NEXT:    # Child Loop BB6_3 Depth 2
-; LA64-NEXT:    bstrpick.d $a2, $a4, 31, 0
-; LA64-NEXT:    sltu $a5, $a3, $a2
+; LA64-NEXT:    addi.w $a5, $a4, 0
+; LA64-NEXT:    sltu $a2, $a3, $a5
----------------
Here. This sign extension instruction should be removed.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/br.ll:29-30
 ; LA64:       # %bb.0:
-; LA64-NEXT:    ld.wu $a2, $a1, 0
-; LA64-NEXT:    bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT:    ld.w $a2, $a1, 0
+; LA64-NEXT:    addi.w $a0, $a0, 0
 ; LA64-NEXT:    beq $a2, $a0, .LBB1_2
----------------
xen0n wrote:
> hev wrote:
> > Future patches will utilize the W instruction, thereby eliminating unnecessary sign extensions.
> Mind explaining a bit what's the codegen you intended? Right now I couldn't think of a `*.w` instruction that would allow us to reduce this basic block any further.
Uh, I posted my comments in the wrong place... It was supposed to appear in the place I marked above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154919



More information about the llvm-commits mailing list