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(i16* nocapture %a) nounwind uwtable readonly ssp {
8 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -8
9 %0 = load i16, i16* %add.ptr, align 2
10 ; ARM: ldrh r0, [r0, #-16]
14 define zeroext i16 @t2(i16* nocapture %a) nounwind uwtable readonly ssp {
17 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -16
18 %0 = load i16, i16* %add.ptr, align 2
19 ; ARM: ldrh r0, [r0, #-32]
23 define zeroext i16 @t3(i16* nocapture %a) nounwind uwtable readonly ssp {
26 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -127
27 %0 = load i16, i16* %add.ptr, align 2
28 ; ARM: ldrh r0, [r0, #-254]
32 define zeroext i16 @t4(i16* nocapture %a) nounwind uwtable readonly ssp {
35 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -128
36 %0 = load i16, i16* %add.ptr, align 2
37 ; ARM: mvn r{{[1-9]}}, #255
38 ; ARM: add r0, r0, r{{[1-9]}}
43 define zeroext i16 @t5(i16* nocapture %a) nounwind uwtable readonly ssp {
46 %add.ptr = getelementptr inbounds i16, i16* %a, i64 8
47 %0 = load i16, i16* %add.ptr, align 2
48 ; ARM: ldrh r0, [r0, #16]
52 define zeroext i16 @t6(i16* nocapture %a) nounwind uwtable readonly ssp {
55 %add.ptr = getelementptr inbounds i16, i16* %a, i64 16
56 %0 = load i16, i16* %add.ptr, align 2
57 ; ARM: ldrh r0, [r0, #32]
61 define zeroext i16 @t7(i16* nocapture %a) nounwind uwtable readonly ssp {
64 %add.ptr = getelementptr inbounds i16, i16* %a, i64 127
65 %0 = load i16, i16* %add.ptr, align 2
66 ; ARM: ldrh r0, [r0, #254]
70 define zeroext i16 @t8(i16* nocapture %a) nounwind uwtable readonly ssp {
73 %add.ptr = getelementptr inbounds i16, i16* %a, i64 128
74 %0 = load i16, i16* %add.ptr, align 2
75 ; ARM: add r0, r0, #256
80 define void @t9(i16* nocapture %a) nounwind uwtable ssp {
83 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -8
84 store i16 0, i16* %add.ptr, align 2
85 ; ARM: movw [[REG0:r[0-9]+]], #0
86 ; ARM: strh [[REG0]], [{{r[0-9]+}}, #-16]
92 define void @t10(i16* nocapture %a) nounwind uwtable ssp {
95 %add.ptr = getelementptr inbounds i16, i16* %a, i64 -128
96 store i16 0, i16* %add.ptr, align 2
98 ; ARM: add [[REG0:r[0-9]+]], r0, r1
99 ; ARM: movw [[REG1:r[0-9]+]], #0
100 ; ARM: strh [[REG1]], {{\[}}[[REG0]]]
104 define void @t11(i16* nocapture %a) nounwind uwtable ssp {
107 %add.ptr = getelementptr inbounds i16, i16* %a, i64 8
108 store i16 0, i16* %add.ptr, align 2
109 ; ARM: movw [[REG1:r[0-9]+]], #0
110 ; ARM: strh [[REG1]], [{{r[0-9]+}}, #16]
116 define void @t12(i16* nocapture %a) nounwind uwtable ssp {
119 %add.ptr = getelementptr inbounds i16, i16* %a, i64 128
120 store i16 0, i16* %add.ptr, align 2
121 ; ARM: add [[REG0:r[0-9]+]], r0, #256
122 ; ARM: movw [[REG1:r[0-9]+]], #0
123 ; ARM: strh [[REG1]], {{\[}}[[REG0]]]
127 define signext i8 @t13(i8* nocapture %a) nounwind uwtable readonly ssp {
130 %add.ptr = getelementptr inbounds i8, i8* %a, i64 -8
131 %0 = load i8, i8* %add.ptr, align 2
132 ; ARM: ldrsb r0, [r0, #-8]
136 define signext i8 @t14(i8* nocapture %a) nounwind uwtable readonly ssp {
139 %add.ptr = getelementptr inbounds i8, i8* %a, i64 -255
140 %0 = load i8, i8* %add.ptr, align 2
141 ; ARM: ldrsb r0, [r0, #-255]
145 define signext i8 @t15(i8* nocapture %a) nounwind uwtable readonly ssp {
148 %add.ptr = getelementptr inbounds i8, i8* %a, i64 -256
149 %0 = load i8, i8* %add.ptr, align 2
150 ; ARM: mvn r{{[1-9]}}, #255
151 ; ARM: add r0, r0, r{{[1-9]}}
152 ; ARM: ldrsb r0, [r0]