1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3; CHECK: {
4; CHECK: loop0(.LBB
5; CHECK-NOT: loop0(##.LBB
6
7target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32"
8target triple = "hexagon"
9
10define i32 @q6zip_uncompress(i8* %out_buf, i32* %out_buf_size, i8* %in_buf, i32 %in_buf_size, i8* nocapture %dict, i32 %dict_size) nounwind {
11entry:
12  %0 = bitcast i8* %in_buf to i32*
13  %incdec.ptr = getelementptr inbounds i8, i8* %in_buf, i32 4
14  %1 = load i32, i32* %0, align 4, !tbaa !0
15  %2 = ptrtoint i8* %incdec.ptr to i32
16  %and.i = and i32 %2, 31
17  %sub.i = sub i32 %2, %and.i
18  %3 = inttoptr i32 %sub.i to i8*
19  %add.i = add i32 %in_buf_size, 31
20  %sub2.i = add i32 %add.i, %and.i
21  %div.i = lshr i32 %sub2.i, 5
22  %4 = tail call i32 @llvm.hexagon.A2.combine.ll(i32 32, i32 %div.i) nounwind
23  %5 = tail call i64 @llvm.hexagon.A4.combineir(i32 32, i32 %4) nounwind
24  tail call void asm sideeffect "l2fetch($0,$1)", "r,r,~{memory}"(i8* %3, i64 %5) nounwind, !srcloc !3
25  %6 = ptrtoint i8* %out_buf to i32
26  br label %for.body.i
27
28for.body.i:                                       ; preds = %for.body.i, %entry
29  %i.02.i = phi i32 [ 0, %entry ], [ %inc.i, %for.body.i ]
30  %addr.addr.01.i = phi i32 [ %6, %entry ], [ %add.i14, %for.body.i ]
31  tail call void asm sideeffect "dczeroa($0)", "r"(i32 %addr.addr.01.i) nounwind, !srcloc !4
32  %add.i14 = add i32 %addr.addr.01.i, 32
33  %inc.i = add i32 %i.02.i, 1
34  %exitcond.i = icmp eq i32 %inc.i, 128
35  br i1 %exitcond.i, label %while.cond.preheader, label %for.body.i
36
37while.cond.preheader:                             ; preds = %for.body.i
38  %and = and i32 %1, 3
39  switch i32 %and, label %infloop.preheader [
40    i32 0, label %exit_inflate.split
41    i32 2, label %if.then.preheader
42  ]
43
44if.then.preheader:                                ; preds = %while.cond.preheader
45  br label %if.then
46
47infloop.preheader:                                ; preds = %while.cond.preheader
48  br label %infloop
49
50if.then:                                          ; preds = %if.then.preheader, %if.then
51  tail call void @llvm.prefetch(i8* %incdec.ptr, i32 0, i32 3, i32 1)
52  br label %if.then
53
54exit_inflate.split:                               ; preds = %while.cond.preheader
55  ret i32 0
56
57infloop:                                          ; preds = %infloop.preheader, %infloop
58  br label %infloop
59}
60
61declare void @llvm.prefetch(i8* nocapture, i32, i32, i32) nounwind
62
63declare i64 @llvm.hexagon.A4.combineir(i32, i32) nounwind readnone
64
65declare i32 @llvm.hexagon.A2.combine.ll(i32, i32) nounwind readnone
66
67!0 = !{!"long", !1}
68!1 = !{!"omnipotent char", !2}
69!2 = !{!"Simple C/C++ TBAA"}
70!3 = !{i32 18362}
71!4 = !{i32 18893}
72