1 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARM
2 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
5 define zeroext i16 @t1(ptr nocapture %a) nounwind uwtable readonly ssp {
8 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -8
9 %0 = load i16, ptr %add.ptr, align 2
10 ; ARM: ldrh r0, [r0, #-16]
14 define zeroext i16 @t2(ptr nocapture %a) nounwind uwtable readonly ssp {
17 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -16
18 %0 = load i16, ptr %add.ptr, align 2
19 ; ARM: ldrh r0, [r0, #-32]
23 define zeroext i16 @t3(ptr nocapture %a) nounwind uwtable readonly ssp {
26 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -127
27 %0 = load i16, ptr %add.ptr, align 2
28 ; ARM: ldrh r0, [r0, #-254]
32 define zeroext i16 @t4(ptr nocapture %a) nounwind uwtable readonly ssp {
35 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -128
36 %0 = load i16, ptr %add.ptr, align 2
37 ; ARM: mvn r{{[1-9]}}, #255
38 ; ARM: add r0, r0, r{{[1-9]}}
43 define zeroext i16 @t5(ptr nocapture %a) nounwind uwtable readonly ssp {
46 %add.ptr = getelementptr inbounds i16, ptr %a, i64 8
47 %0 = load i16, ptr %add.ptr, align 2
48 ; ARM: ldrh r0, [r0, #16]
52 define zeroext i16 @t6(ptr nocapture %a) nounwind uwtable readonly ssp {
55 %add.ptr = getelementptr inbounds i16, ptr %a, i64 16
56 %0 = load i16, ptr %add.ptr, align 2
57 ; ARM: ldrh r0, [r0, #32]
61 define zeroext i16 @t7(ptr nocapture %a) nounwind uwtable readonly ssp {
64 %add.ptr = getelementptr inbounds i16, ptr %a, i64 127
65 %0 = load i16, ptr %add.ptr, align 2
66 ; ARM: ldrh r0, [r0, #254]
70 define zeroext i16 @t8(ptr nocapture %a) nounwind uwtable readonly ssp {
73 %add.ptr = getelementptr inbounds i16, ptr %a, i64 128
74 %0 = load i16, ptr %add.ptr, align 2
75 ; ARM: add r0, r0, #256
80 define void @t9(ptr nocapture %a) nounwind uwtable ssp {
83 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -8
84 store i16 0, ptr %add.ptr, align 2
85 ; ARM: movw [[REG0:r[0-9]+]], #0
86 ; ARM: strh [[REG0]], [{{r[0-9]+}}, #-16]
92 define void @t10(ptr nocapture %a) nounwind uwtable ssp {
95 %add.ptr = getelementptr inbounds i16, ptr %a, i64 -128
96 store i16 0, ptr %add.ptr, align 2
98 ; ARM: movw [[REG1:r[0-9]+]], #0
99 ; ARM: mvn [[REG2:r[0-9]+]], #255
100 ; ARM: add [[REG0:r[0-9]+]], r1, [[REG2]]
101 ; ARM: strh [[REG1]], [[[REG0]]]
105 define void @t11(ptr nocapture %a) nounwind uwtable ssp {
108 %add.ptr = getelementptr inbounds i16, ptr %a, i64 8
109 store i16 0, ptr %add.ptr, align 2
110 ; ARM: movw [[REG1:r[0-9]+]], #0
111 ; ARM: strh [[REG1]], [{{r[0-9]+}}, #16]
117 define void @t12(ptr nocapture %a) nounwind uwtable ssp {
120 %add.ptr = getelementptr inbounds i16, ptr %a, i64 128
121 store i16 0, ptr %add.ptr, align 2
123 ; ARM: movw [[REG1:r[0-9]+]], #0
124 ; ARM: add [[REG0:r[0-9]+]], r1, #256
125 ; ARM: strh [[REG1]], [[[REG0]]]
129 define signext i8 @t13(ptr nocapture %a) nounwind uwtable readonly ssp {
132 %add.ptr = getelementptr inbounds i8, ptr %a, i64 -8
133 %0 = load i8, ptr %add.ptr, align 2
134 ; ARM: ldrsb r0, [r0, #-8]
138 define signext i8 @t14(ptr nocapture %a) nounwind uwtable readonly ssp {
141 %add.ptr = getelementptr inbounds i8, ptr %a, i64 -255
142 %0 = load i8, ptr %add.ptr, align 2
143 ; ARM: ldrsb r0, [r0, #-255]
147 define signext i8 @t15(ptr nocapture %a) nounwind uwtable readonly ssp {
150 %add.ptr = getelementptr inbounds i8, ptr %a, i64 -256
151 %0 = load i8, ptr %add.ptr, align 2
152 ; ARM: mvn r{{[1-9]}}, #255
153 ; ARM: add r0, r0, r{{[1-9]}}
154 ; ARM: ldrsb r0, [r0]