1 ; RUN: llc -mtriple=thumb-eabi -mattr=-thumb2 %s -o - | FileCheck %s -check-prefix CHECK-T1
2 ; RUN: llc -mtriple=thumb-eabi -mattr=+v7 %s -o - | FileCheck %s -check-prefix=THUMB2
3 ; RUN: llc -mtriple=thumb-eabi -mattr=+v7 -mattr=+mp %s -o - | FileCheck %s -check-prefix=THUMB2-MP
4 ; RUN: llc -mtriple=arm-eabi -mattr=+v7 %s -o - | FileCheck %s -check-prefix=ARM
5 ; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s -check-prefix=ARM-MP
10 define void @t1(i8* %ptr) nounwind {
21 ; THUMB2-NOT: pldw [r0]
23 tail call void @llvm.prefetch( i8* %ptr, i32 1, i32 3, i32 1 )
24 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 1 )
28 define void @t2(i8* %ptr) nounwind {
31 ; ARM: pld [r0, #1023]
34 ; THUMB2: pld [r0, #1023]
35 %tmp = getelementptr i8, i8* %ptr, i32 1023
36 tail call void @llvm.prefetch( i8* %tmp, i32 0, i32 3, i32 1 )
40 define void @t3(i32 %base, i32 %offset) nounwind {
43 ; ARM: pld [r0, r1, lsr #2]
46 ; THUMB2: lsrs r1, r1, #2
47 ; THUMB2: pld [r0, r1]
48 %tmp1 = lshr i32 %offset, 2
49 %tmp2 = add i32 %base, %tmp1
50 %tmp3 = inttoptr i32 %tmp2 to i8*
51 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
55 define void @t4(i32 %base, i32 %offset) nounwind {
58 ; ARM: pld [r0, r1, lsl #2]
61 ; THUMB2: pld [r0, r1, lsl #2]
62 %tmp1 = shl i32 %offset, 2
63 %tmp2 = add i32 %base, %tmp1
64 %tmp3 = inttoptr i32 %tmp2 to i8*
65 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
69 declare void @llvm.prefetch(i8*, i32, i32, i32) nounwind
71 define void @t5(i8* %ptr) nounwind {
78 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 0 )
91 ;THUMB2: pld [sp, #50]
92 ;THUMB2: pld [sp, #-50]
94 %red = alloca [100 x i8], align 1
95 %0 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 0
96 %1 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 50
97 %2 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 -50
98 call void @llvm.prefetch(i8* %0, i32 0, i32 3, i32 1)
99 call void @llvm.prefetch(i8* %1, i32 0, i32 3, i32 1)
100 call void @llvm.prefetch(i8* %2, i32 0, i32 3, i32 1)
108 ;ARM-MP: pldw [sp, #50]
109 ;ARM-MP: pldw [sp, #-50]
111 ;THUMB2-MP-LABEL: t7:
112 ;THUMB2-MP: pldw [sp]
113 ;THUMB2-MP: pldw [sp, #50]
114 ;THUMB2-MP: pldw [sp, #-50]
116 %red = alloca [100 x i8], align 1
117 %0 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 0
118 %1 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 50
119 %2 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 -50
120 call void @llvm.prefetch(i8* %0, i32 1, i32 3, i32 1)
121 call void @llvm.prefetch(i8* %1, i32 1, i32 3, i32 1)
122 call void @llvm.prefetch(i8* %2, i32 1, i32 3, i32 1)
135 ;THUMB2: pli [sp, #50]
136 ;THUMB2: pli [sp, #-50]
138 %red = alloca [100 x i8], align 1
139 %0 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 0
140 %1 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 50
141 %2 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 -50
142 call void @llvm.prefetch(i8* %0, i32 0, i32 3, i32 0)
143 call void @llvm.prefetch(i8* %1, i32 0, i32 3, i32 0)
144 call void @llvm.prefetch(i8* %2, i32 0, i32 3, i32 0)