[llvm] [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (PR #107432)
Lu Weining via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 23:21:06 PDT 2024
================
@@ -189,8 +189,6 @@ define signext i32 @sdiv_si32_ui32_ui32(i32 %a, i32 %b) {
;
; LA64-LABEL: sdiv_si32_ui32_ui32:
; LA64: # %bb.0: # %entry
-; LA64-NEXT: addi.w $a1, $a1, 0
----------------
SixWeining wrote:
The English version misses a description about {div,mod}.[wu] while the Chinese version has.
```
在 LoongArch64 位兼容的机器上,执行 DIV.W[U]和 MOD.W[U]指令时,如果通用寄存器 rj 或 rk 中的
数值超过了 32 位有符号数/无符号数的数值范围,则指令执行结果可以为无意义的任意值。
```
Note that "32位有符号数/无符号数" should be "32位有符号数".
This limitation means that we should ensure the input operands are signed extend 32-bits values.
What's more, LoongArch V1.10 introduced a CPUCFG bit indicating whether the above limitation exist or not. If this bit is `1`, we can omit the explict `addi.w $a1, $a1, 0`.
Chinese version: https://www.loongson.cn/download/index
https://github.com/llvm/llvm-project/pull/107432
More information about the llvm-commits
mailing list