This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Report error in AsmParser when rd == rk or rd == rj for AM* instructions
ClosedPublic

Authored by SixWeining on Oct 17 2022, 6:09 AM.

Details

Summary

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.

Diff Detail

Event Timeline

SixWeining created this revision.Oct 17 2022, 6:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 17 2022, 6:09 AM
SixWeining requested review of this revision.Oct 17 2022, 6:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 17 2022, 6:09 AM
xen0n added a comment.Oct 17 2022, 6:34 PM

The changes look good but unfortunately the manual (!) is poorly translated in this case. Quoting verbatim, while still comprehensible, is an eyesore that is better fixed.

Here's my take:

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.

What do you think?

The changes look good but unfortunately the manual (!) is poorly translated in this case. Quoting verbatim, while still comprehensible, is an eyesore that is better fixed.

Here's my take:

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.

What do you think?

That sounds good. I will take. Thanks.

SixWeining edited the summary of this revision. (Show Details)Oct 17 2022, 6:43 PM
xen0n accepted this revision.Oct 17 2022, 7:33 PM
This revision is now accepted and ready to land.Oct 17 2022, 7:33 PM
MaskRay accepted this revision.Oct 17 2022, 9:50 PM