1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s 2 3define 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 10define 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 18define 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 26define 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 35define i8 @f4(i8 %a, i32 %base) { 36entry: 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 45define i8 @f5(i8 %a, i32 %base, i32 %offset) { 46entry: 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 55define i8 @f6(i8 %a, i32 %base, i32 %offset) { 56entry: 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 66define i8 @f7(i8 %a, i32 %base, i32 %offset) { 67entry: 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