[PATCH] D135948: [LoongArch] Add codegen support for cmpxchg on LA64

hev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 01:16:19 PDT 2022


hev added inline comments.


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll:20
+; LA64-NEXT:  .LBB0_1: # =>This Inner Loop Header: Depth=1
+; LA64-NEXT:    dbar 0
+; LA64-NEXT:    ll.w $a4, $a3, 0
----------------
Not needed.

ll: full-membar + load-exclusive


================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll:25-27
+; LA64-NEXT:    xor $a5, $a4, $a2
+; LA64-NEXT:    and $a5, $a5, $a0
+; LA64-NEXT:    xor $a5, $a4, $a5
----------------
I think we should reduce the number of instructions between ll and sc to make ll/sc complete as fast as possible.

for refer: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/loongarch/include/asm/cmpxchg.h?h=next-20221014#n114


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135948



More information about the llvm-commits mailing list