aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
authorWÁNG Xuěruì <git@xen0n.name>2024-11-20 10:41:28 +0800
committerGitHub <noreply@github.com>2024-11-20 10:41:28 +0800
commit8234c612eda1cdff702f5ede1d7db7baf3bf0e47 (patch)
tree9e89a6944c22003c3df7b050fda4e6915c793b90 /llvm/lib/Object/ELFObjectFile.cpp
parent461e58e75dc3e2a0d6e0448c1ebcb8bd14e3d65c (diff)
downloadllvm-8234c612eda1cdff702f5ede1d7db7baf3bf0e47.zip
llvm-8234c612eda1cdff702f5ede1d7db7baf3bf0e47.tar.gz
llvm-8234c612eda1cdff702f5ede1d7db7baf3bf0e47.tar.bz2
[LoongArch] Record the special AMO operand constraint with TableGen (#114398)
Depends on #114508 The LoongArch Reference Manual says that the 3-register atomic memory operations cannot have their rd equal to either rj or rk [^1], and both GNU as and LLVM IAS enforce the constraint for non-zero rd. However, currently LoongArch AsmParser is checking for the opcode with a direct numerical comparison on the opcode, which is enum-typed: the fact that all AMO insns have adjacent numerical values is merely a coincidence, and it is better to not rely on the current TableGen implementation behavior. Instead, start to leverage the target-specific flags field of MCInstrDesc, and record the constraint with TableGen, so we can stop treating the opcode value as number. In doing so, we also have to mark whether the instruction is AMCAS, because the operand index of rj and rk for the AMCAS instructions is different. While documenting the new flag, it was found that v1.10 of the Manual did not specify the similar constraint for the AMCAS instructions. Experiments were done on a Loongson 3A6000 (LA664 uarch) and it turned out that at least AMCAS will still signal INE with `rd == rj`. The `rd == rk` case should be a no-op according to the semantics, but as it is meaningless to perform CAS with the "old value" same as the "new value", it is not worth special-casing. So the current behavior of also enforcing the constraint for AMCAS is kept. [^1]: if `rd == rj` an INE would be signaled; if `rd == rk` it is UB.
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions