1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 < %s | FileCheck --check-prefix=LA464 %s
3 ; RUN: llc --mtriple=loongarch64 --mcpu=la464 < %s | FileCheck --check-prefix=LA464 %s
5 define signext i32 @sum(ptr noalias nocapture noundef readonly %0, i32 noundef signext %1) {
8 ; LA464-NEXT: ori $a2, $zero, 1
9 ; LA464-NEXT: blt $a1, $a2, .LBB0_4
10 ; LA464-NEXT: # %bb.1:
11 ; LA464-NEXT: bstrpick.d $a2, $a1, 31, 0
12 ; LA464-NEXT: move $a1, $zero
13 ; LA464-NEXT: .p2align 4, , 16
14 ; LA464-NEXT: .LBB0_2: # =>This Inner Loop Header: Depth=1
15 ; LA464-NEXT: ld.w $a3, $a0, 0
16 ; LA464-NEXT: add.d $a1, $a3, $a1
17 ; LA464-NEXT: addi.d $a0, $a0, 4
18 ; LA464-NEXT: addi.d $a2, $a2, -1
19 ; LA464-NEXT: bnez $a2, .LBB0_2
20 ; LA464-NEXT: # %bb.3:
21 ; LA464-NEXT: addi.w $a0, $a1, 0
23 ; LA464-NEXT: .LBB0_4:
24 ; LA464-NEXT: move $a1, $zero
25 ; LA464-NEXT: addi.w $a0, $a1, 0
27 %3 = icmp sgt i32 %1, 0
28 br i1 %3, label %4, label %6
31 %5 = zext i32 %1 to i64
35 %7 = phi i32 [ 0, %2 ], [ %13, %8 ]
39 %9 = phi i64 [ 0, %4 ], [ %14, %8 ]
40 %10 = phi i32 [ 0, %4 ], [ %13, %8 ]
41 %11 = getelementptr inbounds i32, ptr %0, i64 %9
42 %12 = load i32, ptr %11, align 4
43 %13 = add nsw i32 %12, %10
44 %14 = add nuw nsw i64 %9, 1
45 %15 = icmp eq i64 %14, %5
46 br i1 %15, label %6, label %8