Home | History | Annotate | Download | only in ARM
      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-mp %s -o - | FileCheck %s -check-prefix=ARM-MP
      5 ; rdar://8601536
      6 
      7 ; CHECK-T1-NOT: pld
      8 
      9 define void @t1(i8* %ptr) nounwind  {
     10 entry:
     11 ; ARM-LABEL: t1:
     12 ; ARM-NOT: pldw [r0]
     13 ; ARM: pld [r0]
     14 
     15 ; ARM-MP-LABEL: t1:
     16 ; ARM-MP: pldw [r0]
     17 ; ARM-MP: pld [r0]
     18 
     19 ; THUMB2-LABEL: t1:
     20 ; THUMB2-NOT: pldw [r0]
     21 ; THUMB2: pld [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 )
     24   ret void
     25 }
     26 
     27 define void @t2(i8* %ptr) nounwind  {
     28 entry:
     29 ; ARM-LABEL: t2:
     30 ; ARM: pld [r0, #1023]
     31 
     32 ; THUMB2-LABEL: t2:
     33 ; THUMB2: pld [r0, #1023]
     34   %tmp = getelementptr i8* %ptr, i32 1023
     35   tail call void @llvm.prefetch( i8* %tmp, i32 0, i32 3, i32 1 )
     36   ret void
     37 }
     38 
     39 define void @t3(i32 %base, i32 %offset) nounwind  {
     40 entry:
     41 ; ARM-LABEL: t3:
     42 ; ARM: pld [r0, r1, lsr #2]
     43 
     44 ; THUMB2-LABEL: t3:
     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 )
     51   ret void
     52 }
     53 
     54 define void @t4(i32 %base, i32 %offset) nounwind  {
     55 entry:
     56 ; ARM-LABEL: t4:
     57 ; ARM: pld [r0, r1, lsl #2]
     58 
     59 ; THUMB2-LABEL: t4:
     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 )
     65   ret void
     66 }
     67 
     68 declare void @llvm.prefetch(i8*, i32, i32, i32) nounwind
     69 
     70 define void @t5(i8* %ptr) nounwind  {
     71 entry:
     72 ; ARM-LABEL: t5:
     73 ; ARM: pli [r0]
     74 
     75 ; THUMB2-LABEL: t5:
     76 ; THUMB2: pli [r0]
     77   tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 0 )
     78   ret void
     79 }
     80 
     81 define void @t6() {
     82 entry:
     83 ;ARM-LABEL: t6:
     84 ;ARM: pld [sp]
     85 ;ARM: pld [sp, #50]
     86 
     87 ;THUMB2-LABEL: t6:
     88 ;THUMB2: pld [sp]
     89 ;THUMB2: pld [sp, #50]
     90 
     91 %red = alloca [100 x i8], align 1
     92 %0 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 0
     93 %1 = getelementptr inbounds [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)
     96 ret void
     97 }
     98