• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=hexagon -hexagon-hwloop-preheader < %s | FileCheck %s
2
3; Generate hardware loops when we also need to add a new preheader.
4; we should generate two hardware loops for this test case.
5
6; CHECK: loop0
7; CHECK: endloop0
8; CHECK: loop0
9; CHECK: endloop0
10
11@g = external global i32
12
13define void @test(i32* nocapture %a, i32* nocapture %b, i32 %n) nounwind {
14entry:
15  %tobool = icmp eq i32 %n, 0
16  br i1 %tobool, label %for.body4.preheader, label %for.body.preheader
17
18for.body.preheader:
19  br label %for.body
20
21for.body:
22  %arrayidx.phi = phi i32* [ %arrayidx.inc, %for.body ], [ %a, %for.body.preheader ]
23  %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
24  %0 = load i32, i32* @g, align 4
25  store i32 %0, i32* %arrayidx.phi, align 4
26  %inc = add nsw i32 %i.014, 1
27  %exitcond15 = icmp eq i32 %inc, 3
28  %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1
29  br i1 %exitcond15, label %for.body4.preheader.loopexit, label %for.body
30
31for.body4.preheader.loopexit:
32  br label %for.body4.preheader
33
34for.body4.preheader:
35  br label %for.body4
36
37for.body4:
38  %arrayidx5.phi = phi i32* [ %arrayidx5.inc, %for.body4 ], [ %b, %for.body4.preheader ]
39  %i1.013 = phi i32 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
40  %1 = load i32, i32* @g, align 4
41  store i32 %1, i32* %arrayidx5.phi, align 4
42  %inc7 = add nsw i32 %i1.013, 1
43  %exitcond = icmp eq i32 %inc7, 3
44  %arrayidx5.inc = getelementptr i32, i32* %arrayidx5.phi, i32 1
45  br i1 %exitcond, label %for.end8, label %for.body4
46
47for.end8:
48  ret void
49}
50