[llvm] [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (PR #107432)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 18:15:39 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
----------------
wangleiat wrote:
We should be more careful with division. for example:
```
define signext i32 @foo(i32 signext %a, i32 signext %b) {
entry:
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%div = sdiv i64 %conv1, %conv
%conv2 = trunc i64 %div to i32
ret i32 %conv2
}
```
In some cases this may not be possible using 32-bit division either.
https://github.com/llvm/llvm-project/pull/107432
More information about the llvm-commits
mailing list