1 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARM 2 ; rdar://10418009 3 4 define zeroext i16 @t1(i16* nocapture %a) nounwind uwtable readonly ssp { 5 entry: 6 ; ARM: t1 7 %add.ptr = getelementptr inbounds i16* %a, i64 -8 8 %0 = load i16* %add.ptr, align 2 9 ; ARM: ldrh r0, [r0, #-16] 10 ret i16 %0 11 } 12 13 define zeroext i16 @t2(i16* nocapture %a) nounwind uwtable readonly ssp { 14 entry: 15 ; ARM: t2 16 %add.ptr = getelementptr inbounds i16* %a, i64 -16 17 %0 = load i16* %add.ptr, align 2 18 ; ARM: ldrh r0, [r0, #-32] 19 ret i16 %0 20 } 21 22 define zeroext i16 @t3(i16* nocapture %a) nounwind uwtable readonly ssp { 23 entry: 24 ; ARM: t3 25 %add.ptr = getelementptr inbounds i16* %a, i64 -127 26 %0 = load i16* %add.ptr, align 2 27 ; ARM: ldrh r0, [r0, #-254] 28 ret i16 %0 29 } 30 31 define zeroext i16 @t4(i16* nocapture %a) nounwind uwtable readonly ssp { 32 entry: 33 ; ARM: t4 34 %add.ptr = getelementptr inbounds i16* %a, i64 -128 35 %0 = load i16* %add.ptr, align 2 36 ; ARM: mvn r{{[1-9]}}, #255 37 ; ARM: add r0, r0, r{{[1-9]}} 38 ; ARM: ldrh r0, [r0] 39 ret i16 %0 40 } 41 42 define zeroext i16 @t5(i16* nocapture %a) nounwind uwtable readonly ssp { 43 entry: 44 ; ARM: t5 45 %add.ptr = getelementptr inbounds i16* %a, i64 8 46 %0 = load i16* %add.ptr, align 2 47 ; ARM: ldrh r0, [r0, #16] 48 ret i16 %0 49 } 50 51 define zeroext i16 @t6(i16* nocapture %a) nounwind uwtable readonly ssp { 52 entry: 53 ; ARM: t6 54 %add.ptr = getelementptr inbounds i16* %a, i64 16 55 %0 = load i16* %add.ptr, align 2 56 ; ARM: ldrh r0, [r0, #32] 57 ret i16 %0 58 } 59 60 define zeroext i16 @t7(i16* nocapture %a) nounwind uwtable readonly ssp { 61 entry: 62 ; ARM: t7 63 %add.ptr = getelementptr inbounds i16* %a, i64 127 64 %0 = load i16* %add.ptr, align 2 65 ; ARM: ldrh r0, [r0, #254] 66 ret i16 %0 67 } 68 69 define zeroext i16 @t8(i16* nocapture %a) nounwind uwtable readonly ssp { 70 entry: 71 ; ARM: t8 72 %add.ptr = getelementptr inbounds i16* %a, i64 128 73 %0 = load i16* %add.ptr, align 2 74 ; ARM: add r0, r0, #256 75 ; ARM: ldrh r0, [r0] 76 ret i16 %0 77 } 78 79 define void @t9(i16* nocapture %a) nounwind uwtable ssp { 80 entry: 81 ; ARM: t9 82 %add.ptr = getelementptr inbounds i16* %a, i64 -8 83 store i16 0, i16* %add.ptr, align 2 84 ; ARM: strh r1, [r0, #-16] 85 ret void 86 } 87 88 ; mvn r1, #255 89 ; strh r2, [r0, r1] 90 define void @t10(i16* nocapture %a) nounwind uwtable ssp { 91 entry: 92 ; ARM: t10 93 %add.ptr = getelementptr inbounds i16* %a, i64 -128 94 store i16 0, i16* %add.ptr, align 2 95 ; ARM: mvn r{{[1-9]}}, #255 96 ; ARM: add r0, r0, r{{[1-9]}} 97 ; ARM: strh r{{[1-9]}}, [r0] 98 ret void 99 } 100 101 define void @t11(i16* nocapture %a) nounwind uwtable ssp { 102 entry: 103 ; ARM: t11 104 %add.ptr = getelementptr inbounds i16* %a, i64 8 105 store i16 0, i16* %add.ptr, align 2 106 ; ARM: strh r{{[1-9]}}, [r0, #16] 107 ret void 108 } 109 110 ; mov r1, #256 111 ; strh r2, [r0, r1] 112 define void @t12(i16* nocapture %a) nounwind uwtable ssp { 113 entry: 114 ; ARM: t12 115 %add.ptr = getelementptr inbounds i16* %a, i64 128 116 store i16 0, i16* %add.ptr, align 2 117 ; ARM: add r0, r0, #256 118 ; ARM: strh r{{[1-9]}}, [r0] 119 ret void 120 } 121 122 define signext i8 @t13(i8* nocapture %a) nounwind uwtable readonly ssp { 123 entry: 124 ; ARM: t13 125 %add.ptr = getelementptr inbounds i8* %a, i64 -8 126 %0 = load i8* %add.ptr, align 2 127 ; ARM: ldrsb r0, [r0, #-8] 128 ret i8 %0 129 } 130 131 define signext i8 @t14(i8* nocapture %a) nounwind uwtable readonly ssp { 132 entry: 133 ; ARM: t14 134 %add.ptr = getelementptr inbounds i8* %a, i64 -255 135 %0 = load i8* %add.ptr, align 2 136 ; ARM: ldrsb r0, [r0, #-255] 137 ret i8 %0 138 } 139 140 define signext i8 @t15(i8* nocapture %a) nounwind uwtable readonly ssp { 141 entry: 142 ; ARM: t15 143 %add.ptr = getelementptr inbounds i8* %a, i64 -256 144 %0 = load i8* %add.ptr, align 2 145 ; ARM: mvn r{{[1-9]}}, #255 146 ; ARM: add r0, r0, r{{[1-9]}} 147 ; ARM: ldrsb r0, [r0] 148 ret i8 %0 149 } 150