[PATCH] D135948: [LoongArch] Add codegen support for cmpxchg on LA64
Gong LingQin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 23:59:04 PDT 2022
gonglingqin added inline comments.
================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll:201
+; LA64-NEXT: .LBB6_4:
+; LA64-NEXT: move $a0, $a3
+; LA64-NEXT: ret
----------------
xen0n wrote:
> Okay so my suspicion is confirmed, and the implementation is wrong... the [[ https://llvm.org/docs/LangRef.html#cmpxchg-instruction | result of a strong `cmpxchg` ]] should be 1 if `$a3 == $a1`, and 0 otherwise. It shouldn't be the original value.
>
> Please check if I'm misunderstanding anything...
> The original value at the location is returned, together with a flag indicating success (true) or failure (false).
The return values of cmpxchg include {original value, i1}, which is checked in this test case for original value.
```
%res = extractvalue { i32, i1 } %tmp, 0
ret i32 %res
```
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