• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4define signext i32 @mulw(i32 signext %s, i32 signext %n, i32 signext %k) nounwind {
5; CHECK-LABEL: mulw:
6; CHECK:       # %bb.0: # %entry
7; CHECK-NEXT:    addi a2, zero, 1
8; CHECK-NEXT:    bge a0, a1, .LBB0_3
9; CHECK-NEXT:  # %bb.1: # %for.body.preheader
10; CHECK-NEXT:    addi a2, zero, 1
11; CHECK-NEXT:  .LBB0_2: # %for.body
12; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
13; CHECK-NEXT:    mulw a2, a0, a2
14; CHECK-NEXT:    addiw a0, a0, 1
15; CHECK-NEXT:    blt a0, a1, .LBB0_2
16; CHECK-NEXT:  .LBB0_3: # %for.cond.cleanup
17; CHECK-NEXT:    mv a0, a2
18; CHECK-NEXT:    ret
19entry:
20  %cmp6 = icmp slt i32 %s, %n
21  br i1 %cmp6, label %for.body, label %for.cond.cleanup
22
23for.cond.cleanup:                                 ; preds = %for.body, %entry
24  %sum.0.lcssa = phi i32 [ 1, %entry ], [ %mul, %for.body ]
25  ret i32 %sum.0.lcssa
26
27for.body:                                         ; preds = %entry, %for.body
28  %i.08 = phi i32 [ %inc, %for.body ], [ %s, %entry ]
29  %sum.07 = phi i32 [ %mul, %for.body ], [ 1, %entry ]
30  %mul = mul nsw i32 %i.08, %sum.07
31  %inc = add nsw i32 %i.08, 1
32  %cmp = icmp slt i32 %inc, %n
33  br i1 %cmp, label %for.body, label %for.cond.cleanup
34}
35