Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc < %s -march=arm | FileCheck %s
      2 
      3 define i32 @f1(i32* %v) {
      4 ; CHECK-LABEL: f1:
      5 ; CHECK: ldr r0
      6 entry:
      7         %tmp = load i32* %v
      8         ret i32 %tmp
      9 }
     10 
     11 define i32 @f2(i32* %v) {
     12 ; CHECK-LABEL: f2:
     13 ; CHECK: ldr r0
     14 entry:
     15         %tmp2 = getelementptr i32* %v, i32 1023
     16         %tmp = load i32* %tmp2
     17         ret i32 %tmp
     18 }
     19 
     20 define i32 @f3(i32* %v) {
     21 ; CHECK-LABEL: f3:
     22 ; CHECK: mov
     23 ; CHECK: ldr r0
     24 entry:
     25         %tmp2 = getelementptr i32* %v, i32 1024
     26         %tmp = load i32* %tmp2
     27         ret i32 %tmp
     28 }
     29 
     30 define i32 @f4(i32 %base) {
     31 ; CHECK-LABEL: f4:
     32 ; CHECK-NOT: mvn
     33 ; CHECK: ldr r0
     34 entry:
     35         %tmp1 = sub i32 %base, 128
     36         %tmp2 = inttoptr i32 %tmp1 to i32*
     37         %tmp3 = load i32* %tmp2
     38         ret i32 %tmp3
     39 }
     40 
     41 define i32 @f5(i32 %base, i32 %offset) {
     42 ; CHECK-LABEL: f5:
     43 ; CHECK: ldr r0
     44 entry:
     45         %tmp1 = add i32 %base, %offset
     46         %tmp2 = inttoptr i32 %tmp1 to i32*
     47         %tmp3 = load i32* %tmp2
     48         ret i32 %tmp3
     49 }
     50 
     51 define i32 @f6(i32 %base, i32 %offset) {
     52 ; CHECK-LABEL: f6:
     53 ; CHECK: ldr r0{{.*}}lsl{{.*}}
     54 entry:
     55         %tmp1 = shl i32 %offset, 2
     56         %tmp2 = add i32 %base, %tmp1
     57         %tmp3 = inttoptr i32 %tmp2 to i32*
     58         %tmp4 = load i32* %tmp3
     59         ret i32 %tmp4
     60 }
     61 
     62 define i32 @f7(i32 %base, i32 %offset) {
     63 ; CHECK-LABEL: f7:
     64 ; CHECK: ldr r0{{.*}}lsr{{.*}}
     65 entry:
     66         %tmp1 = lshr i32 %offset, 2
     67         %tmp2 = add i32 %base, %tmp1
     68         %tmp3 = inttoptr i32 %tmp2 to i32*
     69         %tmp4 = load i32* %tmp3
     70         ret i32 %tmp4
     71 }
     72