Home | History | Annotate | Download | only in Thumb2
      1 ; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
      2 
      3 define i32 @f1(i32 %a, i32* %v) {
      4 ; CHECK-LABEL: f1:
      5 ; CHECK: str r0, [r1]
      6         store i32 %a, i32* %v
      7         ret i32 %a
      8 }
      9 
     10 define i32 @f2(i32 %a, i32* %v) {
     11 ; CHECK-LABEL: f2:
     12 ; CHECK: str.w r0, [r1, #4092]
     13         %tmp2 = getelementptr i32, i32* %v, i32 1023
     14         store i32 %a, i32* %tmp2
     15         ret i32 %a
     16 }
     17 
     18 define i32 @f2a(i32 %a, i32* %v) {
     19 ; CHECK-LABEL: f2a:
     20 ; CHECK: str r0, [r1, #-128]
     21         %tmp2 = getelementptr i32, i32* %v, i32 -32
     22         store i32 %a, i32* %tmp2
     23         ret i32 %a
     24 }
     25 
     26 define i32 @f3(i32 %a, i32* %v) {
     27 ; CHECK-LABEL: f3:
     28 ; CHECK: mov.w r2, #4096
     29 ; CHECK: str r0, [r1, r2]
     30         %tmp2 = getelementptr i32, i32* %v, i32 1024
     31         store i32 %a, i32* %tmp2
     32         ret i32 %a
     33 }
     34 
     35 define i32 @f4(i32 %a, i32 %base) {
     36 entry:
     37 ; CHECK-LABEL: f4:
     38 ; CHECK: str r0, [r1, #-128]
     39         %tmp1 = sub i32 %base, 128
     40         %tmp2 = inttoptr i32 %tmp1 to i32*
     41         store i32 %a, i32* %tmp2
     42         ret i32 %a
     43 }
     44 
     45 define i32 @f5(i32 %a, i32 %base, i32 %offset) {
     46 entry:
     47 ; CHECK-LABEL: f5:
     48 ; CHECK: str r0, [r1, r2]
     49         %tmp1 = add i32 %base, %offset
     50         %tmp2 = inttoptr i32 %tmp1 to i32*
     51         store i32 %a, i32* %tmp2
     52         ret i32 %a
     53 }
     54 
     55 define i32 @f6(i32 %a, i32 %base, i32 %offset) {
     56 entry:
     57 ; CHECK-LABEL: f6:
     58 ; CHECK: str.w r0, [r1, r2, lsl #2]
     59         %tmp1 = shl i32 %offset, 2
     60         %tmp2 = add i32 %base, %tmp1
     61         %tmp3 = inttoptr i32 %tmp2 to i32*
     62         store i32 %a, i32* %tmp3
     63         ret i32 %a
     64 }
     65 
     66 define i32 @f7(i32 %a, i32 %base, i32 %offset) {
     67 entry:
     68 ; CHECK-LABEL: f7:
     69 ; CHECK: lsrs r2, r2, #2
     70 ; CHECK: str r0, [r1, r2]
     71         %tmp1 = lshr i32 %offset, 2
     72         %tmp2 = add i32 %base, %tmp1
     73         %tmp3 = inttoptr i32 %tmp2 to i32*
     74         store i32 %a, i32* %tmp3
     75         ret i32 %a
     76 }
     77