xref: /llvm-project/llvm/test/CodeGen/Hexagon/loopIdiom.ll (revision 75781fa3c77f14640459a97d4265dda76d80e453)
1; RUN: opt -debug -S -march=hexagon -O2  < %s | FileCheck %s
2; REQUIRES: asserts
3; CHECK: define dso_local void @complexMultAccum
4target triple = "hexagon"
5
6; Function Attrs: noinline nounwind
7define dso_local void @complexMultAccum(i32 noundef %n) #0 {
8entry:
9  %n.addr = alloca i32, align 4
10  %run_c_code = alloca i8, align 1
11  %run_asm_code = alloca i8, align 1
12  %iOutter = alloca i32, align 4
13  %iOutter1 = alloca i32, align 4
14  store i32 %n, ptr %n.addr, align 4
15  store i8 1, ptr %run_c_code, align 1
16  store i8 0, ptr %run_asm_code, align 1
17  %0 = load i8, ptr %run_c_code, align 1
18  %tobool = icmp ne i8 %0, 0
19  br i1 %tobool, label %if.then, label %if.end
20
21if.then:                                          ; preds = %entry
22  store i32 0, ptr %iOutter, align 4
23  br label %for.cond
24
25for.cond:                                         ; preds = %for.inc, %if.then
26  %1 = load i32, ptr %iOutter, align 4
27  %cmp = icmp slt i32 %1, 2
28  br i1 %cmp, label %for.body, label %for.end
29
30for.body:                                         ; preds = %for.cond
31  br label %for.inc
32
33for.inc:                                          ; preds = %for.body
34  %2 = load i32, ptr %iOutter, align 4
35  %inc = add nsw i32 %2, 1
36  store i32 %inc, ptr %iOutter, align 4
37  br label %for.cond, !llvm.loop !3
38
39for.end:                                          ; preds = %for.cond
40  store i32 0, ptr %iOutter1, align 4
41  br label %for.cond2
42
43for.cond2:                                        ; preds = %for.inc5, %for.end
44  %3 = load i32, ptr %iOutter1, align 4
45  %cmp3 = icmp slt i32 %3, 2
46  br i1 %cmp3, label %for.body4, label %for.end7
47
48for.body4:                                        ; preds = %for.cond2
49  br label %for.inc5
50
51for.inc5:                                         ; preds = %for.body4
52  %4 = load i32, ptr %iOutter1, align 4
53  %inc6 = add nsw i32 %4, 1
54  store i32 %inc6, ptr %iOutter1, align 4
55  br label %for.cond2, !llvm.loop !5
56
57for.end7:                                         ; preds = %for.cond2
58  br label %if.end
59
60if.end:                                           ; preds = %for.end7, %entry
61  ret void
62}
63
64attributes #0 = { noinline nounwind "approx-func-fp-math"="true" "frame-pointer"="all" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv79" "target-features"="+v79,-long-calls" "unsafe-fp-math"="true" }
65
66!llvm.module.flags = !{!0, !1}
67!llvm.ident = !{!2}
68
69!0 = !{i32 1, !"wchar_size", i32 4}
70!1 = !{i32 7, !"frame-pointer", i32 2}
71!2 = !{!"LLVM Clang"}
72!3 = distinct !{!3, !4}
73!4 = !{!"llvm.loop.mustprogress"}
74!5 = distinct !{!5, !4}
75
76