[PATCH] D131229: [LoongArch] Add codegen support for atomicrmw xchg operation on LA32
WÁNG Xuěruì via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 15 00:24:40 PDT 2022
xen0n added inline comments.
================
Comment at: llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp:111
+ // beq scratch, zero, loop
+ BuildMI(LoopMBB, DL, TII->get(LoongArch::DBAR)).addImm(0);
+ BuildMI(LoopMBB, DL, TII->get(LoongArch::LL_W), DestReg)
----------------
In GCC they apparently used `dbar 0x700` for open-coded atomic CAS templates, that seemed to result from a hardware erratum. If in a future hardware iteration this `dbar` is going to become unnecessary, coding `dbar 0x700` here might be a good idea.
You may confirm with the CPU designers and the GCC team for this.
================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw.ll:26
+; LA32-NEXT: srl.w $a0, $a4, $a0
+; LA32-NEXT: jirl $zero, $ra, 0
+;
----------------
Have to rebase...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131229/new/
https://reviews.llvm.org/D131229
More information about the llvm-commits
mailing list