[llvm] [LoongArch] Select {DIV,MOD}.{W,WU} instruction to eliminate explicit sign extension (PR #92205)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 23:35:25 PDT 2024


https://github.com/SixWeining approved this pull request.

We suppose there is a description error in ISA Manual (Volume I) - V1.10:
```
在 LoongArch64 位兼容的机器上,执行 DIV.W[U]和 MOD.W[U]指令时,如果通用寄存器 rj 或 rk 中的
数值超过了 32 位有符号数/无符号数的数值范围,则指令执行结果可以为无意义的任意值。
```

In V1.03, it is:
```
在 LoongArch64 位兼容的机器上,执行 DIV.W[U]和 MOD.W[U]指令时,如果通用寄存器 rj 或 rk 中的
数值超过了 32 位有符号数的数值范围,则指令执行结果可以为无意义的任意值。
```

The difference is `/无符号数`. According the hardware behavior and gcc's output, it is incorrect which means this PR is right. I will accept.

https://github.com/llvm/llvm-project/pull/92205


More information about the llvm-commits mailing list