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(ptr %ptr) nounwind {
21 ; THUMB2-NOT: pldw [r0]
23 tail call void @llvm.prefetch( ptr %ptr, i32 1, i32 3, i32 1 )
24 tail call void @llvm.prefetch( ptr %ptr, i32 0, i32 3, i32 1 )
28 define void @t2(ptr %ptr) nounwind {
31 ; ARM: pld [r0, #1023]
34 ; THUMB2: pld [r0, #1023]
35 %tmp = getelementptr i8, ptr %ptr, i32 1023
36 tail call void @llvm.prefetch( ptr %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 ptr
51 tail call void @llvm.prefetch( ptr %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 ptr
65 tail call void @llvm.prefetch( ptr %tmp3, i32 0, i32 3, i32 1 )
69 declare void @llvm.prefetch(ptr, i32, i32, i32) nounwind
71 define void @t5(ptr %ptr) nounwind {
78 tail call void @llvm.prefetch( ptr %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], ptr %red, i32 0, i32 50
96 %1 = getelementptr inbounds [100 x i8], ptr %red, i32 0, i32 -50
97 call void @llvm.prefetch(ptr %red, i32 0, i32 3, i32 1)
98 call void @llvm.prefetch(ptr %0, i32 0, i32 3, i32 1)
99 call void @llvm.prefetch(ptr %1, i32 0, i32 3, i32 1)
107 ;ARM-MP: pldw [sp, #50]
108 ;ARM-MP: pldw [sp, #-50]
110 ;THUMB2-MP-LABEL: t7:
111 ;THUMB2-MP: pldw [sp]
112 ;THUMB2-MP: pldw [sp, #50]
113 ;THUMB2-MP: pldw [sp, #-50]
115 %red = alloca [100 x i8], align 1
116 %0 = getelementptr inbounds [100 x i8], ptr %red, i32 0, i32 50
117 %1 = getelementptr inbounds [100 x i8], ptr %red, i32 0, i32 -50
118 call void @llvm.prefetch(ptr %red, i32 1, i32 3, i32 1)
119 call void @llvm.prefetch(ptr %0, i32 1, i32 3, i32 1)
120 call void @llvm.prefetch(ptr %1, i32 1, i32 3, i32 1)
133 ;THUMB2: pli [sp, #50]
134 ;THUMB2: pli [sp, #-50]
136 %red = alloca [100 x i8], align 1
137 %0 = getelementptr inbounds [100 x i8], ptr %red, i32 0, i32 50
138 %1 = getelementptr inbounds [100 x i8], ptr %red, i32 0, i32 -50
139 call void @llvm.prefetch(ptr %red, i32 0, i32 3, i32 0)
140 call void @llvm.prefetch(ptr %0, i32 0, i32 3, i32 0)
141 call void @llvm.prefetch(ptr %1, i32 0, i32 3, i32 0)