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=arm-eabi -mattr=+v7 %s -o - | FileCheck %s -check-prefix=ARM
4 ; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s -check-prefix=ARM-MP
9 define void @t1(i8* %ptr) nounwind {
20 ; THUMB2-NOT: pldw [r0]
22 tail call void @llvm.prefetch( i8* %ptr, i32 1, i32 3, i32 1 )
23 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 1 )
27 define void @t2(i8* %ptr) nounwind {
30 ; ARM: pld [r0, #1023]
33 ; THUMB2: pld [r0, #1023]
34 %tmp = getelementptr i8, i8* %ptr, i32 1023
35 tail call void @llvm.prefetch( i8* %tmp, i32 0, i32 3, i32 1 )
39 define void @t3(i32 %base, i32 %offset) nounwind {
42 ; ARM: pld [r0, r1, lsr #2]
45 ; THUMB2: lsrs r1, r1, #2
46 ; THUMB2: pld [r0, r1]
47 %tmp1 = lshr i32 %offset, 2
48 %tmp2 = add i32 %base, %tmp1
49 %tmp3 = inttoptr i32 %tmp2 to i8*
50 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
54 define void @t4(i32 %base, i32 %offset) nounwind {
57 ; ARM: pld [r0, r1, lsl #2]
60 ; THUMB2: pld [r0, r1, lsl #2]
61 %tmp1 = shl i32 %offset, 2
62 %tmp2 = add i32 %base, %tmp1
63 %tmp3 = inttoptr i32 %tmp2 to i8*
64 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
68 declare void @llvm.prefetch(i8*, i32, i32, i32) nounwind
70 define void @t5(i8* %ptr) nounwind {
77 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 0 )
89 ;THUMB2: pld [sp, #50]
91 %red = alloca [100 x i8], align 1
92 %0 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 0
93 %1 = getelementptr inbounds [100 x i8], [100 x i8]* %red, i32 0, i32 50
94 call void @llvm.prefetch(i8* %0, i32 0, i32 3, i32 1)
95 call void @llvm.prefetch(i8* %1, i32 0, i32 3, i32 1)