1 ; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner -verify-machineinstrs < %s | FileCheck %s
3 ; If the trip count is a compile-time constant, then decrement it instead
4 ; of computing a new LC0 value.
7 ; CHECK: loop0(.LBB0_1,#999)
9 define i32 @test(ptr %A, ptr %B, i32 %count) {
14 %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
15 %arrayidx.phi = phi ptr [ %A, %entry ], [ %arrayidx.inc, %for.body ]
16 %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
17 %0 = load i32, ptr %arrayidx.phi, align 4
18 %add = add nsw i32 %0, %sum.02
19 %inc = add nsw i32 %i.01, 1
20 %exitcond = icmp eq i32 %inc, 1000
21 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
22 br i1 %exitcond, label %for.end, label %for.body
28 ; The constant trip count is small enough that the kernel is not executed.
33 define i32 @test1(ptr %A, ptr %B, i32 %count) {
38 %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
39 %arrayidx.phi = phi ptr [ %A, %entry ], [ %arrayidx.inc, %for.body ]
40 %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
41 %0 = load i32, ptr %arrayidx.phi, align 4
42 %add = add nsw i32 %0, %sum.02
43 %inc = add nsw i32 %i.01, 1
44 %exitcond = icmp eq i32 %inc, 1
45 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
46 br i1 %exitcond, label %for.end, label %for.body