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

Lu Weining via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 18:19:19 PST 2024


================
@@ -0,0 +1,75 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc --mtriple=loongarch64 -mattr=+d,-div32 < %s | FileCheck %s --check-prefix=LA64
+; RUN: llc --mtriple=loongarch64 -mattr=+d,+div32 < %s | FileCheck %s --check-prefix=LA64-DIV32
+
+define i32 @divw(i64 %0, i64 %1) {
+; LA64-LABEL: divw:
+; LA64:       # %bb.0:
+; LA64-NEXT:    addi.w $a1, $a1, 0
+; LA64-NEXT:    addi.w $a0, $a0, 0
+; LA64-NEXT:    div.w $a0, $a0, $a1
+; LA64-NEXT:    ret
+;
+; LA64-DIV32-LABEL: divw:
+; LA64-DIV32:       # %bb.0:
+; LA64-DIV32-NEXT:    div.w $a0, $a0, $a1
+; LA64-DIV32-NEXT:    ret
+  %3 = trunc i64 %0 to i32
----------------
SixWeining wrote:

Ditto.

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


More information about the cfe-commits mailing list