[LoongArch] Report error in AsmParser when rd == rk or rd == rj for AM* instructions
authorWeining Lu <luweining@loongson.cn>
Fri, 21 Oct 2022 01:56:27 +0000 (09:56 +0800)
committerWeining Lu <luweining@loongson.cn>
Fri, 21 Oct 2022 01:56:45 +0000 (09:56 +0800)
commitc98add7a11ff35d42fee860f9c9d301601ff5861
tree9e92a0d67a893e37a1cb4e10a9e4801ad8f41a75
parent1a91537d4ddd757a51c131ce6e8f25f2d1fbb3d3
[LoongArch] Report error in AsmParser when rd == rk or rd == rj for AM* instructions

Do this check because the ISA manual says (edited from the original translation):

> If the AM* instruction has its rd == rj, an Instruction Non-defined Exception will be triggered when the instruction is executed.
>
> If the AM* instruction has its rd == rk, the execution result is unpredictable. It is software's responsibility to avoid this situation.

Note that binutils does the same check except when rd == r0 but this
is undocumented.

Differential Revision: https://reviews.llvm.org/D136076
llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
llvm/test/MC/LoongArch/Basic/Integer/invalid64.s