1 ; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
3 @a = common global i32* null, align 8
5 define void @test(i32 %i, i32 %j) nounwind ssp {
8 %j.addr = alloca i32, align 4
9 store i32 %j, i32* %j.addr, align 4, !tbaa !0
10 %tmp = bitcast i32* %j.addr to i8*
11 ; CHECK: prfum pldl1strm
12 call void @llvm.prefetch(i8* %tmp, i32 0, i32 0, i32 1)
13 ; CHECK: prfum pldl3keep
14 call void @llvm.prefetch(i8* %tmp, i32 0, i32 1, i32 1)
15 ; CHECK: prfum pldl2keep
16 call void @llvm.prefetch(i8* %tmp, i32 0, i32 2, i32 1)
17 ; CHECK: prfum pldl1keep
18 call void @llvm.prefetch(i8* %tmp, i32 0, i32 3, i32 1)
20 ; CHECK: prfum plil1strm
21 call void @llvm.prefetch(i8* %tmp, i32 0, i32 0, i32 0)
22 ; CHECK: prfum plil3keep
23 call void @llvm.prefetch(i8* %tmp, i32 0, i32 1, i32 0)
24 ; CHECK: prfum plil2keep
25 call void @llvm.prefetch(i8* %tmp, i32 0, i32 2, i32 0)
26 ; CHECK: prfum plil1keep
27 call void @llvm.prefetch(i8* %tmp, i32 0, i32 3, i32 0)
29 ; CHECK: prfum pstl1strm
30 call void @llvm.prefetch(i8* %tmp, i32 1, i32 0, i32 1)
31 ; CHECK: prfum pstl3keep
32 call void @llvm.prefetch(i8* %tmp, i32 1, i32 1, i32 1)
33 ; CHECK: prfum pstl2keep
34 call void @llvm.prefetch(i8* %tmp, i32 1, i32 2, i32 1)
35 ; CHECK: prfum pstl1keep
36 call void @llvm.prefetch(i8* %tmp, i32 1, i32 3, i32 1)
38 %tmp1 = load i32, i32* %j.addr, align 4, !tbaa !0
39 %add = add nsw i32 %tmp1, %i
40 %idxprom = sext i32 %add to i64
41 %tmp2 = load i32*, i32** @a, align 8, !tbaa !3
42 %arrayidx = getelementptr inbounds i32, i32* %tmp2, i64 %idxprom
43 %tmp3 = bitcast i32* %arrayidx to i8*
45 ; CHECK: prfm pldl1strm
46 call void @llvm.prefetch(i8* %tmp3, i32 0, i32 0, i32 1)
47 %tmp4 = load i32*, i32** @a, align 8, !tbaa !3
48 %arrayidx3 = getelementptr inbounds i32, i32* %tmp4, i64 %idxprom
49 %tmp5 = bitcast i32* %arrayidx3 to i8*
51 ; CHECK: prfm pldl3keep
52 call void @llvm.prefetch(i8* %tmp5, i32 0, i32 1, i32 1)
53 %tmp6 = load i32*, i32** @a, align 8, !tbaa !3
54 %arrayidx6 = getelementptr inbounds i32, i32* %tmp6, i64 %idxprom
55 %tmp7 = bitcast i32* %arrayidx6 to i8*
57 ; CHECK: prfm pldl2keep
58 call void @llvm.prefetch(i8* %tmp7, i32 0, i32 2, i32 1)
59 %tmp8 = load i32*, i32** @a, align 8, !tbaa !3
60 %arrayidx9 = getelementptr inbounds i32, i32* %tmp8, i64 %idxprom
61 %tmp9 = bitcast i32* %arrayidx9 to i8*
63 ; CHECK: prfm pldl1keep
64 call void @llvm.prefetch(i8* %tmp9, i32 0, i32 3, i32 1)
65 %tmp10 = load i32*, i32** @a, align 8, !tbaa !3
66 %arrayidx12 = getelementptr inbounds i32, i32* %tmp10, i64 %idxprom
67 %tmp11 = bitcast i32* %arrayidx12 to i8*
70 ; CHECK: prfm plil1strm
71 call void @llvm.prefetch(i8* %tmp11, i32 0, i32 0, i32 0)
72 %tmp12 = load i32*, i32** @a, align 8, !tbaa !3
73 %arrayidx15 = getelementptr inbounds i32, i32* %tmp12, i64 %idxprom
74 %tmp13 = bitcast i32* %arrayidx3 to i8*
76 ; CHECK: prfm plil3keep
77 call void @llvm.prefetch(i8* %tmp13, i32 0, i32 1, i32 0)
78 %tmp14 = load i32*, i32** @a, align 8, !tbaa !3
79 %arrayidx18 = getelementptr inbounds i32, i32* %tmp14, i64 %idxprom
80 %tmp15 = bitcast i32* %arrayidx6 to i8*
82 ; CHECK: prfm plil2keep
83 call void @llvm.prefetch(i8* %tmp15, i32 0, i32 2, i32 0)
84 %tmp16 = load i32*, i32** @a, align 8, !tbaa !3
85 %arrayidx21 = getelementptr inbounds i32, i32* %tmp16, i64 %idxprom
86 %tmp17 = bitcast i32* %arrayidx9 to i8*
88 ; CHECK: prfm plil1keep
89 call void @llvm.prefetch(i8* %tmp17, i32 0, i32 3, i32 0)
90 %tmp18 = load i32*, i32** @a, align 8, !tbaa !3
91 %arrayidx24 = getelementptr inbounds i32, i32* %tmp18, i64 %idxprom
92 %tmp19 = bitcast i32* %arrayidx12 to i8*
95 ; CHECK: prfm pstl1strm
96 call void @llvm.prefetch(i8* %tmp19, i32 1, i32 0, i32 1)
97 %tmp20 = load i32*, i32** @a, align 8, !tbaa !3
98 %arrayidx27 = getelementptr inbounds i32, i32* %tmp20, i64 %idxprom
99 %tmp21 = bitcast i32* %arrayidx15 to i8*
101 ; CHECK: prfm pstl3keep
102 call void @llvm.prefetch(i8* %tmp21, i32 1, i32 1, i32 1)
103 %tmp22 = load i32*, i32** @a, align 8, !tbaa !3
104 %arrayidx30 = getelementptr inbounds i32, i32* %tmp22, i64 %idxprom
105 %tmp23 = bitcast i32* %arrayidx18 to i8*
107 ; CHECK: prfm pstl2keep
108 call void @llvm.prefetch(i8* %tmp23, i32 1, i32 2, i32 1)
109 %tmp24 = load i32*, i32** @a, align 8, !tbaa !3
110 %arrayidx33 = getelementptr inbounds i32, i32* %tmp24, i64 %idxprom
111 %tmp25 = bitcast i32* %arrayidx21 to i8*
113 ; CHECK: prfm pstl1keep
114 call void @llvm.prefetch(i8* %tmp25, i32 1, i32 3, i32 1)
118 declare void @llvm.prefetch(i8* nocapture, i32, i32, i32) nounwind
121 !1 = !{!"omnipotent char", !2}
122 !2 = !{!"Simple C/C++ TBAA"}
123 !3 = !{!"any pointer", !1}