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