1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+m -verify-machineinstrs < %s | FileCheck %s
4 define signext i32 @mulw(i32 signext %s, i32 signext %n, i32 signext %k) nounwind {
6 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: bge a0, a1, .LBB0_2
9 ; CHECK-NEXT: .LBB0_1: # %for.body
10 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
11 ; CHECK-NEXT: mulw a2, a0, a2
12 ; CHECK-NEXT: addiw a0, a0, 1
13 ; CHECK-NEXT: blt a0, a1, .LBB0_1
14 ; CHECK-NEXT: .LBB0_2: # %for.cond.cleanup
15 ; CHECK-NEXT: mv a0, a2
18 %cmp6 = icmp slt i32 %s, %n
19 br i1 %cmp6, label %for.body, label %for.cond.cleanup
21 for.cond.cleanup: ; preds = %for.body, %entry
22 %sum.0.lcssa = phi i32 [ 1, %entry ], [ %mul, %for.body ]
25 for.body: ; preds = %entry, %for.body
26 %i.08 = phi i32 [ %inc, %for.body ], [ %s, %entry ]
27 %sum.07 = phi i32 [ %mul, %for.body ], [ 1, %entry ]
28 %mul = mul nsw i32 %i.08, %sum.07
29 %inc = add nsw i32 %i.08, 1
30 %cmp = icmp slt i32 %inc, %n
31 br i1 %cmp, label %for.body, label %for.cond.cleanup