1 ; Test data prefetching.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare void @llvm.prefetch(ptr, i32, i32, i32)
7 @g = dso_local global [4096 x i8] zeroinitializer
9 ; Check that instruction read prefetches are ignored.
10 define dso_local void @f1(ptr %ptr) {
14 call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 0)
18 ; Check that instruction write prefetches are ignored.
19 define dso_local void @f2(ptr %ptr) {
23 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 0)
27 ; Check data read prefetches.
28 define dso_local void @f3(ptr %ptr) {
30 ; CHECK: pfd 1, 0(%r2)
32 call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
36 ; Check data write prefetches.
37 define dso_local void @f4(ptr %ptr) {
39 ; CHECK: pfd 2, 0(%r2)
41 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 1)
45 ; Check an address at the negative end of the range.
46 define dso_local void @f5(ptr %base, i64 %index) {
48 ; CHECK: pfd 2, -524288({{%r2,%r3|%r3,%r2}})
50 %add = add i64 %index, -524288
51 %ptr = getelementptr i8, ptr %base, i64 %add
52 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 1)
56 ; Check an address at the positive end of the range.
57 define dso_local void @f6(ptr %base, i64 %index) {
59 ; CHECK: pfd 2, 524287({{%r2,%r3|%r3,%r2}})
61 %add = add i64 %index, 524287
62 %ptr = getelementptr i8, ptr %base, i64 %add
63 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 1)
67 ; Check that the next address up still compiles.
68 define dso_local void @f7(ptr %base, i64 %index) {
73 %add = add i64 %index, 524288
74 %ptr = getelementptr i8, ptr %base, i64 %add
75 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 1)
79 ; Check pc-relative prefetches.
80 define dso_local void @f8() {
84 %ptr = getelementptr [4096 x i8], ptr@g, i64 0, i64 0
85 call void @llvm.prefetch(ptr %ptr, i32 1, i32 0, i32 1)