1 ; RUN: llc -march=hexagon -hexagon-hwloop-preheader < %s | FileCheck %s
3 ; Generate hardware loops when we also need to add a new preheader.
4 ; we should generate two hardware loops for this test case.
11 @g = external global i32
13 define void @test(ptr nocapture %a, ptr nocapture %b, i32 %n) nounwind {
15 %tobool = icmp eq i32 %n, 0
16 br i1 %tobool, label %for.body4.preheader, label %for.body.preheader
22 %arrayidx.phi = phi ptr [ %arrayidx.inc, %for.body ], [ %a, %for.body.preheader ]
23 %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
24 %0 = load i32, ptr @g, align 4
25 store i32 %0, ptr %arrayidx.phi, align 4
26 %inc = add nsw i32 %i.014, 1
27 %exitcond15 = icmp eq i32 %inc, 3
28 %arrayidx.inc = getelementptr i32, ptr %arrayidx.phi, i32 1
29 br i1 %exitcond15, label %for.body4.preheader.loopexit, label %for.body
31 for.body4.preheader.loopexit:
32 br label %for.body4.preheader
38 %arrayidx5.phi = phi ptr [ %arrayidx5.inc, %for.body4 ], [ %b, %for.body4.preheader ]
39 %i1.013 = phi i32 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
40 %1 = load i32, ptr @g, align 4
41 store i32 %1, ptr %arrayidx5.phi, align 4
42 %inc7 = add nsw i32 %i1.013, 1
43 %exitcond = icmp eq i32 %inc7, 3
44 %arrayidx5.inc = getelementptr i32, ptr %arrayidx5.phi, i32 1
45 br i1 %exitcond, label %for.end8, label %for.body4