1 ; RUN: llc < %s -march=thumb -mattr=-thumb2 | not grep pld
2 ; RUN: llc < %s -march=thumb -mattr=+v7 | FileCheck %s -check-prefix=THUMB2
3 ; RUN: llc < %s -march=arm -mattr=+v7 | FileCheck %s -check-prefix=ARM
4 ; RUN: llc < %s -march=arm -mcpu=cortex-a9-mp | FileCheck %s -check-prefix=ARM-MP
7 define void @t1(i8* %ptr) nounwind {
18 ; THUMB2-NOT: pldw [r0]
20 tail call void @llvm.prefetch( i8* %ptr, i32 1, i32 3, i32 1 )
21 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 1 )
25 define void @t2(i8* %ptr) nounwind {
28 ; ARM: pld [r0, #1023]
31 ; THUMB2: pld [r0, #1023]
32 %tmp = getelementptr i8* %ptr, i32 1023
33 tail call void @llvm.prefetch( i8* %tmp, i32 0, i32 3, i32 1 )
37 define void @t3(i32 %base, i32 %offset) nounwind {
40 ; ARM: pld [r0, r1, lsr #2]
43 ; THUMB2: lsrs r1, r1, #2
44 ; THUMB2: pld [r0, r1]
45 %tmp1 = lshr i32 %offset, 2
46 %tmp2 = add i32 %base, %tmp1
47 %tmp3 = inttoptr i32 %tmp2 to i8*
48 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
52 define void @t4(i32 %base, i32 %offset) nounwind {
55 ; ARM: pld [r0, r1, lsl #2]
58 ; THUMB2: pld [r0, r1, lsl #2]
59 %tmp1 = shl i32 %offset, 2
60 %tmp2 = add i32 %base, %tmp1
61 %tmp3 = inttoptr i32 %tmp2 to i8*
62 tail call void @llvm.prefetch( i8* %tmp3, i32 0, i32 3, i32 1 )
66 declare void @llvm.prefetch(i8*, i32, i32, i32) nounwind
68 define void @t5(i8* %ptr) nounwind {
75 tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 0 )