aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/SystemZ/prefetch-01.ll
blob: bb7fea99ca7c8c3b60feec811a93336867a3bf74 (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
; Test data prefetching.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s

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

@g = global [4096 x i8] zeroinitializer

; Check that instruction read prefetches are ignored.
define void @f1(i8 *%ptr) {
; CHECK-LABEL: f1:
; CHECK-NOT: %r2
; CHECK: br %r14
  call void @llvm.prefetch(i8 *%ptr, i32 0, i32 0, i32 0)
  ret void
}

; Check that instruction write prefetches are ignored.
define void @f2(i8 *%ptr) {
; CHECK-LABEL: f2:
; CHECK-NOT: %r2
; CHECK: br %r14
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 0)
  ret void
}

; Check data read prefetches.
define void @f3(i8 *%ptr) {
; CHECK-LABEL: f3:
; CHECK: pfd 1, 0(%r2)
; CHECK: br %r14
  call void @llvm.prefetch(i8 *%ptr, i32 0, i32 0, i32 1)
  ret void
}

; Check data write prefetches.
define void @f4(i8 *%ptr) {
; CHECK-LABEL: f4:
; CHECK: pfd 2, 0(%r2)
; CHECK: br %r14
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 1)
  ret void
}

; Check an address at the negative end of the range.
define void @f5(i8 *%base, i64 %index) {
; CHECK-LABEL: f5:
; CHECK: pfd 2, -524288({{%r2,%r3|%r3,%r2}})
; CHECK: br %r14
  %add = add i64 %index, -524288
  %ptr = getelementptr i8 *%base, i64 %add
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 1)
  ret void
}

; Check an address at the positive end of the range.
define void @f6(i8 *%base, i64 %index) {
; CHECK-LABEL: f6:
; CHECK: pfd 2, 524287({{%r2,%r3|%r3,%r2}})
; CHECK: br %r14
  %add = add i64 %index, 524287
  %ptr = getelementptr i8 *%base, i64 %add
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 1)
  ret void
}

; Check that the next address up still compiles.
define void @f7(i8 *%base, i64 %index) {
; CHECK-LABEL: f7:
; CHECK: 524288
; CHECK: pfd 2,
; CHECK: br %r14
  %add = add i64 %index, 524288
  %ptr = getelementptr i8 *%base, i64 %add
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 1)
  ret void
}

; Check pc-relative prefetches.
define void @f8() {
; CHECK-LABEL: f8:
; CHECK: pfdrl 2, g
; CHECK: br %r14
  %ptr = getelementptr [4096 x i8] *@g, i64 0, i64 0
  call void @llvm.prefetch(i8 *%ptr, i32 1, i32 0, i32 1)
  ret void
}