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 3 4--- | 5 define i8 @test_load_i8(i8* %p1) { 6 %r = load i8, i8* %p1 7 ret i8 %r 8 } 9 10 define i16 @test_load_i16(i16* %p1) { 11 %r = load i16, i16* %p1 12 ret i16 %r 13 } 14 15 define i32 @test_load_i32(i32* %p1) { 16 %r = load i32, i32* %p1 17 ret i32 %r 18 } 19 20 define i8* @test_store_i8(i8 %val, i8* %p1) { 21 store i8 %val, i8* %p1 22 ret i8* %p1 23 } 24 25 define i16* @test_store_i16(i16 %val, i16* %p1) { 26 store i16 %val, i16* %p1 27 ret i16* %p1 28 } 29 30 define i32* @test_store_i32(i32 %val, i32* %p1) { 31 store i32 %val, i32* %p1 32 ret i32* %p1 33 } 34 35 define i32* @test_load_ptr(i32** %ptr1) { 36 %p = load i32*, i32** %ptr1 37 ret i32* %p 38 } 39 40 define void @test_store_ptr(i32** %ptr1, i32* %a) { 41 store i32* %a, i32** %ptr1 42 ret void 43 } 44 45... 46--- 47name: test_load_i8 48alignment: 4 49legalized: true 50regBankSelected: true 51registers: 52 - { id: 0, class: gpr } 53 - { id: 1, class: gpr } 54 - { id: 2, class: gpr } 55fixedStack: 56 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false } 57body: | 58 bb.1 (%ir-block.0): 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 0) 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 0) 66 %2(s8) = G_LOAD %0(p0) :: (load 1 from %ir.p1) 67 $al = COPY %2(s8) 68 RET 0, implicit $al 69 70... 71--- 72name: test_load_i16 73alignment: 4 74legalized: true 75regBankSelected: true 76registers: 77 - { id: 0, class: gpr } 78 - { id: 1, class: gpr } 79 - { id: 2, class: gpr } 80fixedStack: 81 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false } 82body: | 83 bb.1 (%ir-block.0): 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 0) 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 0) 91 %2(s16) = G_LOAD %0(p0) :: (load 2 from %ir.p1) 92 $ax = COPY %2(s16) 93 RET 0, implicit $ax 94 95... 96--- 97name: test_load_i32 98alignment: 4 99legalized: true 100regBankSelected: true 101registers: 102 - { id: 0, class: gpr } 103 - { id: 1, class: gpr } 104 - { id: 2, class: gpr } 105fixedStack: 106 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false } 107body: | 108 bb.1 (%ir-block.0): 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 0) 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 0) 116 %2(s32) = G_LOAD %0(p0) :: (load 4 from %ir.p1) 117 $eax = COPY %2(s32) 118 RET 0, implicit $eax 119 120... 121--- 122name: test_store_i8 123alignment: 4 124legalized: true 125regBankSelected: true 126registers: 127 - { id: 0, class: gpr } 128 - { id: 1, class: gpr } 129 - { id: 2, class: gpr } 130 - { id: 3, class: gpr } 131fixedStack: 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 } 134body: | 135 bb.1 (%ir-block.0): 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 0) 138 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1, align 0) 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 0) 144 %3(p0) = G_FRAME_INDEX %fixed-stack.0 145 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 0) 146 G_STORE %0(s8), %1(p0) :: (store 1 into %ir.p1) 147 $eax = COPY %1(p0) 148 RET 0, implicit $eax 149 150... 151--- 152name: test_store_i16 153alignment: 4 154legalized: true 155regBankSelected: true 156registers: 157 - { id: 0, class: gpr } 158 - { id: 1, class: gpr } 159 - { id: 2, class: gpr } 160 - { id: 3, class: gpr } 161fixedStack: 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 } 164body: | 165 bb.1 (%ir-block.0): 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 0) 168 ; ALL: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1, align 0) 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 0) 174 %3(p0) = G_FRAME_INDEX %fixed-stack.0 175 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 0) 176 G_STORE %0(s16), %1(p0) :: (store 2 into %ir.p1) 177 $eax = COPY %1(p0) 178 RET 0, implicit $eax 179 180... 181--- 182name: test_store_i32 183alignment: 4 184legalized: true 185regBankSelected: true 186registers: 187 - { id: 0, class: gpr } 188 - { id: 1, class: gpr } 189 - { id: 2, class: gpr } 190 - { id: 3, class: gpr } 191fixedStack: 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 } 194body: | 195 bb.1 (%ir-block.0): 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 0) 198 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1, align 0) 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 0) 204 %3(p0) = G_FRAME_INDEX %fixed-stack.0 205 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 0) 206 G_STORE %0(s32), %1(p0) :: (store 4 into %ir.p1) 207 $eax = COPY %1(p0) 208 RET 0, implicit $eax 209 210... 211--- 212name: test_load_ptr 213alignment: 4 214legalized: true 215regBankSelected: true 216registers: 217 - { id: 0, class: gpr } 218 - { id: 1, class: gpr } 219 - { id: 2, class: gpr } 220fixedStack: 221 - { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false } 222body: | 223 bb.1 (%ir-block.0): 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 0) 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 0) 231 %2(p0) = G_LOAD %0(p0) :: (load 4 from %ir.ptr1) 232 $eax = COPY %2(p0) 233 RET 0, implicit $eax 234 235... 236--- 237name: test_store_ptr 238alignment: 4 239legalized: true 240regBankSelected: true 241registers: 242 - { id: 0, class: gpr } 243 - { id: 1, class: gpr } 244 - { id: 2, class: gpr } 245 - { id: 3, class: gpr } 246fixedStack: 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 } 249body: | 250 bb.1 (%ir-block.0): 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 0) 253 ; ALL: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (invariant load 4 from %fixed-stack.1, align 0) 254 ; ALL: MOV32mr [[MOV32rm]], 1, $noreg, 0, $noreg, [[MOV32rm1]] :: (store 4 into %ir.ptr1) 255 ; ALL: RET 0 256 %2(p0) = G_FRAME_INDEX %fixed-stack.1 257 %0(p0) = G_LOAD %2(p0) :: (invariant load 4 from %fixed-stack.1, align 0) 258 %3(p0) = G_FRAME_INDEX %fixed-stack.0 259 %1(p0) = G_LOAD %3(p0) :: (invariant load 4 from %fixed-stack.0, align 0) 260 G_STORE %1(p0), %0(p0) :: (store 4 into %ir.ptr1) 261 RET 0 262 263... 264