[PATCH] D135948: [LoongArch] Add codegen support for cmpxchg on LA64
WÁNG Xuěruì via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 03:59:17 PDT 2022
xen0n added inline comments.
================
Comment at: llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll:326
+; LA64-NEXT: .LBB10_4:
+; LA64-NEXT: bstrpick.d $a0, $a1, 31, 0
+; LA64-NEXT: xor $a0, $a3, $a0
----------------
This seems wrong: the following `xor` insn responsible for the `same value -> 0` part operates on full GRLen, but here `a1` i.e. `%cmp` gets zero-extended to `a0`, yet `a3` i.e. the value from memory is loaded with `ll.w` that sign-extends. I expect this will fail for cases where `cmp == *ptr && cmp < 0`.
Either this should be a sign-extension, or the comparison shouldn't be `xor`.
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