1 ; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
2 ; RUN: llc -O0 --global-isel-abort=1 < %s -mtriple=arm64-eabi | FileCheck %s
4 @a = common global ptr null, align 8
6 define void @test(i32 %i, i32 %j) nounwind ssp {
9 %j.addr = alloca i32, align 4
10 store i32 %j, ptr %j.addr, align 4, !tbaa !0
11 ; CHECK: prfum pldl1strm
12 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 0, i32 1)
13 ; CHECK: prfum pldl3keep
14 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 1, i32 1)
15 ; CHECK: prfum pldl2keep
16 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 2, i32 1)
17 ; CHECK: prfum pldl1keep
18 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 3, i32 1)
20 ; CHECK: prfum plil1strm
21 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 0, i32 0)
22 ; CHECK: prfum plil3keep
23 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 1, i32 0)
24 ; CHECK: prfum plil2keep
25 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 2, i32 0)
26 ; CHECK: prfum plil1keep
27 call void @llvm.prefetch(ptr %j.addr, i32 0, i32 3, i32 0)
29 ; CHECK: prfum pstl1strm
30 call void @llvm.prefetch(ptr %j.addr, i32 1, i32 0, i32 1)
31 ; CHECK: prfum pstl3keep
32 call void @llvm.prefetch(ptr %j.addr, i32 1, i32 1, i32 1)
33 ; CHECK: prfum pstl2keep
34 call void @llvm.prefetch(ptr %j.addr, i32 1, i32 2, i32 1)
35 ; CHECK: prfum pstl1keep
36 call void @llvm.prefetch(ptr %j.addr, i32 1, i32 3, i32 1)
38 %tmp1 = load i32, ptr %j.addr, align 4, !tbaa !0
39 %add = add nsw i32 %tmp1, %i
40 %idxprom = sext i32 %add to i64
41 %tmp2 = load ptr, ptr @a, align 8, !tbaa !3
42 %arrayidx = getelementptr inbounds i32, ptr %tmp2, i64 %idxprom
44 ; CHECK: prfm pldl1strm
45 call void @llvm.prefetch(ptr %arrayidx, i32 0, i32 0, i32 1)
46 %tmp4 = load ptr, ptr @a, align 8, !tbaa !3
47 %arrayidx3 = getelementptr inbounds i32, ptr %tmp4, i64 %idxprom
49 ; CHECK: prfm pldl3keep
50 call void @llvm.prefetch(ptr %arrayidx3, i32 0, i32 1, i32 1)
51 %tmp6 = load ptr, ptr @a, align 8, !tbaa !3
52 %arrayidx6 = getelementptr inbounds i32, ptr %tmp6, i64 %idxprom
54 ; CHECK: prfm pldl2keep
55 call void @llvm.prefetch(ptr %arrayidx6, i32 0, i32 2, i32 1)
56 %tmp8 = load ptr, ptr @a, align 8, !tbaa !3
57 %arrayidx9 = getelementptr inbounds i32, ptr %tmp8, i64 %idxprom
59 ; CHECK: prfm pldl1keep
60 call void @llvm.prefetch(ptr %arrayidx9, i32 0, i32 3, i32 1)
61 %tmp10 = load ptr, ptr @a, align 8, !tbaa !3
62 %arrayidx12 = getelementptr inbounds i32, ptr %tmp10, i64 %idxprom
65 ; CHECK: prfm plil1strm
66 call void @llvm.prefetch(ptr %arrayidx12, i32 0, i32 0, i32 0)
67 %tmp12 = load ptr, ptr @a, align 8, !tbaa !3
68 %arrayidx15 = getelementptr inbounds i32, ptr %tmp12, i64 %idxprom
70 ; CHECK: prfm plil3keep
71 call void @llvm.prefetch(ptr %arrayidx3, i32 0, i32 1, i32 0)
72 %tmp14 = load ptr, ptr @a, align 8, !tbaa !3
73 %arrayidx18 = getelementptr inbounds i32, ptr %tmp14, i64 %idxprom
75 ; CHECK: prfm plil2keep
76 call void @llvm.prefetch(ptr %arrayidx6, i32 0, i32 2, i32 0)
77 %tmp16 = load ptr, ptr @a, align 8, !tbaa !3
78 %arrayidx21 = getelementptr inbounds i32, ptr %tmp16, i64 %idxprom
80 ; CHECK: prfm plil1keep
81 call void @llvm.prefetch(ptr %arrayidx9, i32 0, i32 3, i32 0)
82 %tmp18 = load ptr, ptr @a, align 8, !tbaa !3
83 %arrayidx24 = getelementptr inbounds i32, ptr %tmp18, i64 %idxprom
86 ; CHECK: prfm pstl1strm
87 call void @llvm.prefetch(ptr %arrayidx12, i32 1, i32 0, i32 1)
88 %tmp20 = load ptr, ptr @a, align 8, !tbaa !3
89 %arrayidx27 = getelementptr inbounds i32, ptr %tmp20, i64 %idxprom
91 ; CHECK: prfm pstl3keep
92 call void @llvm.prefetch(ptr %arrayidx15, i32 1, i32 1, i32 1)
93 %tmp22 = load ptr, ptr @a, align 8, !tbaa !3
94 %arrayidx30 = getelementptr inbounds i32, ptr %tmp22, i64 %idxprom
96 ; CHECK: prfm pstl2keep
97 call void @llvm.prefetch(ptr %arrayidx18, i32 1, i32 2, i32 1)
98 %tmp24 = load ptr, ptr @a, align 8, !tbaa !3
99 %arrayidx33 = getelementptr inbounds i32, ptr %tmp24, i64 %idxprom
101 ; CHECK: prfm pstl1keep
102 call void @llvm.prefetch(ptr %arrayidx21, i32 1, i32 3, i32 1)
106 declare void @llvm.prefetch(ptr nocapture, i32, i32, i32) nounwind
109 !1 = !{!"omnipotent char", !2}
110 !2 = !{!"Simple C/C++ TBAA"}
111 !3 = !{!"any pointer", !1}