[clang] [llvm] [LoongArch] Support LA V1.1 feature that div.w[u] and mod.w[u] instructions with inputs not signed-extended. (PR #116764)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 00:49:49 PST 2024


================
@@ -121,7 +121,7 @@ define i32 @sdiv_i32(i32 %a, i32 %b) {
 ; LA64:       # %bb.0: # %entry
 ; LA64-NEXT:    addi.w $a1, $a1, 0
 ; LA64-NEXT:    addi.w $a0, $a0, 0
-; LA64-NEXT:    div.d $a0, $a0, $a1
+; LA64-NEXT:    div.w $a0, $a0, $a1
----------------
heiher wrote:

These cases are allowed when `div32` is enabled, as it eliminates unnecessary sign-extend instructions.

https://github.com/llvm/llvm-project/blob/7e85cb8a8a9de57ed10635b843662148a87b17e5/llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp#L142-L146

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


More information about the cfe-commits mailing list