1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=i386-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL
5 define i8 @test_load_i8(i8* %p1) {
10 define i16 @test_load_i16(i16* %p1) {
11 %r = load i16, i16* %p1
15 define i32 @test_load_i32(i32* %p1) {
16 %r = load i32, i32* %p1
20 define i8* @test_store_i8(i8 %val, i8* %p1) {
21 store i8 %val, i8* %p1
25 define i16* @test_store_i16(i16 %val, i16* %p1) {
26 store i16 %val, i16* %p1
30 define i32* @test_store_i32(i32 %val, i32* %p1) {
31 store i32 %val, i32* %p1
35 define i32* @test_load_ptr(i32** %ptr1) {
36 %p = load i32*, i32** %ptr1
40 define void @test_store_ptr(i32** %ptr1, i32* %a) {
41 store i32* %a, i32** %ptr1
52 - { id: 0, class: gpr }
53 - { id: 1, class: gpr }
54 - { id: 2, class: gpr }
56 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
59 ; ALL-LABEL: name: test_load_i8
60 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
61 ; ALL: [[MOV8rm:%[0-9]+]]:gr8 = MOV8rm [[MOV32rm]], 1, $noreg, 0, $noreg :: (load 1 from %ir.p1)
62 ; ALL: $al = COPY [[MOV8rm]]
63 ; ALL: RET 0, implicit $al
64 %1(p0) = G_FRAME_INDEX %fixed-stack.0
65 %0(p0) = G_LOAD %1(p0) :: (invariant load 4 from %fixed-stack.0, align 16)
66 %2(s8) = G_LOAD %0(p0) :: (load 1 from %ir.p1)
77 - { id: 0, class: gpr }
78 - { id: 1, class: gpr }
79 - { id: 2, class: gpr }
81 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
84 ; ALL-LABEL: name: test_load_i16
85 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
86 ; ALL: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm [[MOV32rm]], 1, $noreg, 0, $noreg :: (load 2 from %ir.p1)
87 ; ALL: $ax = COPY [[MOV16rm]]
88 ; ALL: RET 0, implicit $ax
89 %1(p0) = G_FRAME_INDEX %fixed-stack.0
90 %0(p0) = G_LOAD %1(p0) :: (invariant load 4 from %fixed-stack.0, align 16)
91 %2(s16) = G_LOAD %0(p0) :: (load 2 from %ir.p1)
100 regBankSelected: true
102 - { id: 0, class: gpr }
103 - { id: 1, class: gpr }
104 - { id: 2, class: gpr }
106 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
109 ; ALL-LABEL: name: test_load_i32
110 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
111 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm [[MOV32rm]], 1, $noreg, 0, $noreg :: (load 4 from %ir.p1)
112 ; ALL: $eax = COPY [[MOV32rm1]]
113 ; ALL: RET 0, implicit $eax
114 %1(p0) = G_FRAME_INDEX %fixed-stack.0
115 %0(p0) = G_LOAD %1(p0) :: (invariant load 4 from %fixed-stack.0, align 16)
116 %2(s32) = G_LOAD %0(p0) :: (load 4 from %ir.p1)
125 regBankSelected: true
127 - { id: 0, class: gpr }
128 - { id: 1, class: gpr }
129 - { id: 2, class: gpr }
130 - { id: 3, class: gpr }
132 - { id: 0, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
133 - { id: 1, offset: 0, size: 1, alignment: 16, isImmutable: true, isAliased: false }
136 ; ALL-LABEL: name: test_store_i8
137 ; ALL: [[MOV8rm:%[0-9]+]]:gr8 = MOV8rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 1 from %fixed-stack.0, align 16)
138 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1)
139 ; ALL: MOV8mr [[MOV32rm]], 1, $noreg, 0, $noreg, [[MOV8rm]] :: (store 1 into %ir.p1)
140 ; ALL: $eax = COPY [[MOV32rm]]
141 ; ALL: RET 0, implicit $eax
142 %2(p0) = G_FRAME_INDEX %fixed-stack.1
143 %0(s8) = G_LOAD %2(p0) :: (invariant load 1 from %fixed-stack.1, align 16)
144 %3(p0) = G_FRAME_INDEX %fixed-stack.0
145 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 4)
146 G_STORE %0(s8), %1(p0) :: (store 1 into %ir.p1)
155 regBankSelected: true
157 - { id: 0, class: gpr }
158 - { id: 1, class: gpr }
159 - { id: 2, class: gpr }
160 - { id: 3, class: gpr }
162 - { id: 0, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
163 - { id: 1, offset: 0, size: 2, alignment: 16, isImmutable: true, isAliased: false }
166 ; ALL-LABEL: name: test_store_i16
167 ; ALL: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 2 from %fixed-stack.0, align 16)
168 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1)
169 ; ALL: MOV16mr [[MOV32rm]], 1, $noreg, 0, $noreg, [[MOV16rm]] :: (store 2 into %ir.p1)
170 ; ALL: $eax = COPY [[MOV32rm]]
171 ; ALL: RET 0, implicit $eax
172 %2(p0) = G_FRAME_INDEX %fixed-stack.1
173 %0(s16) = G_LOAD %2(p0) :: (invariant load 2 from %fixed-stack.1, align 16)
174 %3(p0) = G_FRAME_INDEX %fixed-stack.0
175 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 4)
176 G_STORE %0(s16), %1(p0) :: (store 2 into %ir.p1)
185 regBankSelected: true
187 - { id: 0, class: gpr }
188 - { id: 1, class: gpr }
189 - { id: 2, class: gpr }
190 - { id: 3, class: gpr }
192 - { id: 0, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
193 - { id: 1, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
196 ; ALL-LABEL: name: test_store_i32
197 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
198 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1)
199 ; ALL: MOV32mr [[MOV32rm1]], 1, $noreg, 0, $noreg, [[MOV32rm]] :: (store 4 into %ir.p1)
200 ; ALL: $eax = COPY [[MOV32rm1]]
201 ; ALL: RET 0, implicit $eax
202 %2(p0) = G_FRAME_INDEX %fixed-stack.1
203 %0(s32) = G_LOAD %2(p0) :: (invariant load 4 from %fixed-stack.1, align 16)
204 %3(p0) = G_FRAME_INDEX %fixed-stack.0
205 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 4)
206 G_STORE %0(s32), %1(p0) :: (store 4 into %ir.p1)
215 regBankSelected: true
217 - { id: 0, class: gpr }
218 - { id: 1, class: gpr }
219 - { id: 2, class: gpr }
221 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
224 ; ALL-LABEL: name: test_load_ptr
225 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
226 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm [[MOV32rm]], 1, $noreg, 0, $noreg :: (load 4 from %ir.ptr1)
227 ; ALL: $eax = COPY [[MOV32rm1]]
228 ; ALL: RET 0, implicit $eax
229 %1(p0) = G_FRAME_INDEX %fixed-stack.0
230 %0(p0) = G_LOAD %1(p0) :: (invariant load 4 from %fixed-stack.0, align 16)
231 %2(p0) = G_LOAD %0(p0) :: (load 4 from %ir.ptr1)
240 regBankSelected: true
242 - { id: 0, class: gpr }
243 - { id: 1, class: gpr }
244 - { id: 2, class: gpr }
245 - { id: 3, class: gpr }
247 - { id: 0, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
248 - { id: 1, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
251 ; ALL-LABEL: name: test_store_ptr
252 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.0, align 16)
253 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1)
254 ; ALL: MOV32mr [[MOV32rm]], 1, $noreg, 0, $noreg, [[MOV32rm1]] :: (store 4 into %ir.ptr1)
256 %2(p0) = G_FRAME_INDEX %fixed-stack.1
257 %0(p0) = G_LOAD %2(p0) :: (invariant load 4 from %fixed-stack.1, align 16)
258 %3(p0) = G_FRAME_INDEX %fixed-stack.0
259 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 4)
260 G_STORE %1(p0), %0(p0) :: (store 4 into %ir.ptr1)