aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/AArch64/arm64-prefetch.ll
blob: aac3515c4278545e9392644862a6aac3e46ec2e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
; RUN: llc %s -march arm64 -o - | FileCheck %s

@a = common global i32* null, align 8

define void @test(i32 %i, i32 %j) nounwind ssp {
entry:
  ; CHECK: @test
  %j.addr = alloca i32, align 4
  store i32 %j, i32* %j.addr, align 4, !tbaa !0
  %tmp = bitcast i32* %j.addr to i8*
  ; CHECK: prfum pldl1strm
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 0, i32 1)
  ; CHECK: prfum pldl3keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 1, i32 1)
  ; CHECK: prfum pldl2keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 2, i32 1)
  ; CHECK: prfum pldl1keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 3, i32 1)

  ; CHECK: prfum plil1strm
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 0, i32 0)
  ; CHECK: prfum plil3keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 1, i32 0)
  ; CHECK: prfum plil2keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 2, i32 0)
  ; CHECK: prfum plil1keep
  call void @llvm.prefetch(i8* %tmp, i32 0, i32 3, i32 0)

  ; CHECK: prfum pstl1strm
  call void @llvm.prefetch(i8* %tmp, i32 1, i32 0, i32 1)
  ; CHECK: prfum pstl3keep
  call void @llvm.prefetch(i8* %tmp, i32 1, i32 1, i32 1)
  ; CHECK: prfum pstl2keep
  call void @llvm.prefetch(i8* %tmp, i32 1, i32 2, i32 1)
  ; CHECK: prfum pstl1keep
  call void @llvm.prefetch(i8* %tmp, i32 1, i32 3, i32 1)

  %tmp1 = load i32* %j.addr, align 4, !tbaa !0
  %add = add nsw i32 %tmp1, %i
  %idxprom = sext i32 %add to i64
  %tmp2 = load i32** @a, align 8, !tbaa !3
  %arrayidx = getelementptr inbounds i32* %tmp2, i64 %idxprom
  %tmp3 = bitcast i32* %arrayidx to i8*

  ; CHECK: prfm pldl1strm
  call void @llvm.prefetch(i8* %tmp3, i32 0, i32 0, i32 1)
  %tmp4 = load i32** @a, align 8, !tbaa !3
  %arrayidx3 = getelementptr inbounds i32* %tmp4, i64 %idxprom
  %tmp5 = bitcast i32* %arrayidx3 to i8*

  ; CHECK: prfm pldl3keep
  call void @llvm.prefetch(i8* %tmp5, i32 0, i32 1, i32 1)
  %tmp6 = load i32** @a, align 8, !tbaa !3
  %arrayidx6 = getelementptr inbounds i32* %tmp6, i64 %idxprom
  %tmp7 = bitcast i32* %arrayidx6 to i8*

  ; CHECK: prfm pldl2keep
  call void @llvm.prefetch(i8* %tmp7, i32 0, i32 2, i32 1)
  %tmp8 = load i32** @a, align 8, !tbaa !3
  %arrayidx9 = getelementptr inbounds i32* %tmp8, i64 %idxprom
  %tmp9 = bitcast i32* %arrayidx9 to i8*

  ; CHECK: prfm pldl1keep
  call void @llvm.prefetch(i8* %tmp9, i32 0, i32 3, i32 1)
  %tmp10 = load i32** @a, align 8, !tbaa !3
  %arrayidx12 = getelementptr inbounds i32* %tmp10, i64 %idxprom
  %tmp11 = bitcast i32* %arrayidx12 to i8*


  ; CHECK: prfm plil1strm
  call void @llvm.prefetch(i8* %tmp11, i32 0, i32 0, i32 0)
  %tmp12 = load i32** @a, align 8, !tbaa !3
  %arrayidx15 = getelementptr inbounds i32* %tmp12, i64 %idxprom
  %tmp13 = bitcast i32* %arrayidx3 to i8*

  ; CHECK: prfm plil3keep
  call void @llvm.prefetch(i8* %tmp13, i32 0, i32 1, i32 0)
  %tmp14 = load i32** @a, align 8, !tbaa !3
  %arrayidx18 = getelementptr inbounds i32* %tmp14, i64 %idxprom
  %tmp15 = bitcast i32* %arrayidx6 to i8*

  ; CHECK: prfm plil2keep
  call void @llvm.prefetch(i8* %tmp15, i32 0, i32 2, i32 0)
  %tmp16 = load i32** @a, align 8, !tbaa !3
  %arrayidx21 = getelementptr inbounds i32* %tmp16, i64 %idxprom
  %tmp17 = bitcast i32* %arrayidx9 to i8*

  ; CHECK: prfm plil1keep
  call void @llvm.prefetch(i8* %tmp17, i32 0, i32 3, i32 0)
  %tmp18 = load i32** @a, align 8, !tbaa !3
  %arrayidx24 = getelementptr inbounds i32* %tmp18, i64 %idxprom
  %tmp19 = bitcast i32* %arrayidx12 to i8*


  ; CHECK: prfm pstl1strm
  call void @llvm.prefetch(i8* %tmp19, i32 1, i32 0, i32 1)
  %tmp20 = load i32** @a, align 8, !tbaa !3
  %arrayidx27 = getelementptr inbounds i32* %tmp20, i64 %idxprom
  %tmp21 = bitcast i32* %arrayidx15 to i8*

  ; CHECK: prfm pstl3keep
  call void @llvm.prefetch(i8* %tmp21, i32 1, i32 1, i32 1)
  %tmp22 = load i32** @a, align 8, !tbaa !3
  %arrayidx30 = getelementptr inbounds i32* %tmp22, i64 %idxprom
  %tmp23 = bitcast i32* %arrayidx18 to i8*

  ; CHECK: prfm pstl2keep
  call void @llvm.prefetch(i8* %tmp23, i32 1, i32 2, i32 1)
  %tmp24 = load i32** @a, align 8, !tbaa !3
  %arrayidx33 = getelementptr inbounds i32* %tmp24, i64 %idxprom
  %tmp25 = bitcast i32* %arrayidx21 to i8*

  ; CHECK: prfm pstl1keep
  call void @llvm.prefetch(i8* %tmp25, i32 1, i32 3, i32 1)
  ret void
}

declare void @llvm.prefetch(i8* nocapture, i32, i32, i32) nounwind

!0 = !{!"int", !1}
!1 = !{!"omnipotent char", !2}
!2 = !{!"Simple C/C++ TBAA"}
!3 = !{!"any pointer", !1}