1 # RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses the machine memory operands
7 define i32 @test(i32* %a) {
14 define void @test2(i32* %"a value") {
16 %b = load i32, i32* %"a value"
18 store i32 %c, i32* %"a value"
22 define i32 @volatile_inc(i32* %x) {
24 %0 = load volatile i32, i32* %x
26 store volatile i32 %1, i32* %x
30 define void @non_temporal_store(i32* %a, i32 %b) {
32 store i32 %b, i32* %a, align 16, !nontemporal !0
38 define i32 @invariant_load(i32* %x) {
40 %v = load i32, i32* %x, !invariant.load !1
46 define void @memory_offset(<8 x float>* %vec) {
48 %v = load <8 x float>, <8 x float>* %vec
49 %v2 = insertelement <8 x float> %v, float 0.0, i32 4
50 store <8 x float> %v2, <8 x float>* %vec
54 define void @memory_alignment(<8 x float>* %vec) {
56 %v = load <8 x float>, <8 x float>* %vec
57 %v2 = insertelement <8 x float> %v, float 0.0, i32 4
58 store <8 x float> %v2, <8 x float>* %vec
62 define double @constant_pool_psv(double %a) {
64 %b = fadd double %a, 3.250000e+00
68 declare x86_fp80 @cosl(x86_fp80) #0
70 define x86_fp80 @stack_psv(x86_fp80 %x) {
72 %y = call x86_fp80 @cosl(x86_fp80 %x) #0
76 attributes #0 = { readonly }
78 @G = external global i32
80 define i32 @got_psv() {
82 %a = load i32, i32* @G
87 define i32 @global_value() {
89 %a = load i32, i32* @G
94 define i32 @jumptable_psv(i32 %in) {
96 switch i32 %in, label %def [
114 %struct.XXH_state64_t = type { i32, i32, i64, i64, i64 }
116 @a = common global i32 0, align 4
118 define i32 @tbaa_metadata() {
120 %0 = load i32, i32* @a, align 4, !tbaa !2
121 %1 = inttoptr i32 %0 to %struct.XXH_state64_t*
122 %total_len2 = bitcast %struct.XXH_state64_t* %1 to i32*
123 %2 = load i32, i32* %total_len2, align 4, !tbaa !6
127 !2 = !{!3, !3, i64 0}
128 !3 = !{!"int", !4, i64 0}
129 !4 = !{!"omnipotent char", !5, i64 0}
130 !5 = !{!"Simple C/C++ TBAA"}
131 !6 = !{!7, !3, i64 0}
132 !7 = !{!"XXH_state64_t", !3, i64 0, !3, i64 4, !8, i64 8, !8, i64 16, !8, i64 24}
133 !8 = !{!"long long", !4, i64 0}
135 define void @aa_scope(float* nocapture %a, float* nocapture readonly %c) #1 {
137 %0 = load float, float* %c, align 4, !alias.scope !9
138 %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
139 store float %0, float* %arrayidx.i, align 4, !noalias !9
140 %1 = load float, float* %c, align 4
141 %arrayidx = getelementptr inbounds float, float* %a, i64 7
142 store float %1, float* %arrayidx, align 4
146 attributes #1 = { nounwind uwtable }
148 !9 = distinct !{!9, !10, !"some scope"}
149 !10 = distinct !{!10, !"some domain"}
154 tracksRegLiveness: true
160 ; CHECK: %eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)
161 ; CHECK-NEXT: MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)
162 %eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)
163 MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)
168 tracksRegLiveness: true
174 ; CHECK: INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")
175 INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")
180 tracksRegLiveness: true
186 ; CHECK: name: volatile_inc
187 ; CHECK: %eax = MOV32rm %rdi, 1, _, 0, _ :: (volatile load 4 from %ir.x)
188 ; CHECK: MOV32mr killed %rdi, 1, _, 0, _, %eax :: (volatile store 4 into %ir.x)
189 %eax = MOV32rm %rdi, 1, _, 0, _ :: (volatile load 4 from %ir.x)
190 %eax = INC32r killed %eax, implicit-def dead %eflags
191 MOV32mr killed %rdi, 1, _, 0, _, %eax :: (volatile store 4 into %ir.x)
195 name: non_temporal_store
196 tracksRegLiveness: true
203 ; CHECK: name: non_temporal_store
204 ; CHECK: MOVNTImr killed %rdi, 1, _, 0, _, killed %esi :: (non-temporal store 4 into %ir.a)
205 MOVNTImr killed %rdi, 1, _, 0, _, killed %esi :: (non-temporal store 4 into %ir.a)
210 tracksRegLiveness: true
216 ; CHECK: name: invariant_load
217 ; CHECK: %eax = MOV32rm killed %rdi, 1, _, 0, _ :: (invariant load 4 from %ir.x)
218 %eax = MOV32rm killed %rdi, 1, _, 0, _ :: (invariant load 4 from %ir.x)
223 tracksRegLiveness: true
229 ; CHECK: name: memory_offset
230 ; CHECK: %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)
231 ; CHECK-NEXT: %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)
232 ; CHECK: MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)
233 ; CHECK-NEXT: MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)
234 %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)
235 %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)
237 %xmm1 = MOVSSrr killed %xmm1, killed %xmm2
238 MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)
239 MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)
243 name: memory_alignment
244 tracksRegLiveness: true
250 ; CHECK: name: memory_alignment
251 ; CHECK: %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec, align 32)
252 ; CHECK-NEXT: %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16, align 32)
253 ; CHECK: MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec, align 32)
254 ; CHECK-NEXT: MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16, align 32)
255 %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec, align 32)
256 %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16, align 32)
258 %xmm1 = MOVSSrr killed %xmm1, killed %xmm2
259 MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec, align 32)
260 MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16, align 32)
264 name: constant_pool_psv
265 tracksRegLiveness: true
270 value: 'double 3.250000e+00'
274 ; CHECK: name: constant_pool_psv
275 ; CHECK: %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool)
276 ; CHECK-NEXT: %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool + 8)
277 %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool)
278 %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool + 8)
283 tracksRegLiveness: true
291 - { id: 0, offset: 0, size: 10, alignment: 16, isImmutable: true, isAliased: false }
294 %rsp = frame-setup SUB64ri8 %rsp, 24, implicit-def dead %eflags
295 CFI_INSTRUCTION .cfi_def_cfa_offset 32
296 LD_F80m %rsp, 1, _, 32, _, implicit-def dead %fpsw
297 ; CHECK: name: stack_psv
298 ; CHECK: ST_FP80m %rsp, 1, _, 0, _, implicit-def dead %fpsw :: (store 10 into stack, align 16)
299 ST_FP80m %rsp, 1, _, 0, _, implicit-def dead %fpsw :: (store 10 into stack, align 16)
300 CALL64pcrel32 $cosl, csr_64, implicit %rsp, implicit-def %rsp, implicit-def %fp0
301 %rsp = ADD64ri8 %rsp, 24, implicit-def dead %eflags
306 tracksRegLiveness: true
309 ; CHECK: name: got_psv
310 ; CHECK: %rax = MOV64rm %rip, 1, _, @G, _ :: (load 8 from got)
311 %rax = MOV64rm %rip, 1, _, @G, _ :: (load 8 from got)
312 %eax = MOV32rm killed %rax, 1, _, 0, _
313 %eax = INC32r killed %eax, implicit-def dead %eflags
318 tracksRegLiveness: true
321 %rax = MOV64rm %rip, 1, _, @G, _
322 ; CHECK: name: global_value
323 ; CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.G)
324 %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.G)
325 %eax = INC32r killed %eax, implicit-def dead %eflags
330 tracksRegLiveness: true
334 kind: label-difference32
337 blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
340 successors: %bb.2.def, %bb.1.entry
343 %eax = MOV32rr %edi, implicit-def %rax
344 CMP32ri8 killed %edi, 3, implicit-def %eflags
345 JA_1 %bb.2.def, implicit killed %eflags
348 successors: %bb.3.lbl1, %bb.4.lbl2, %bb.5.lbl3, %bb.6.lbl4
351 %rcx = LEA64r %rip, 1, _, %jump-table.0, _
352 ; CHECK: name: jumptable_psv
353 ; CHECK: %rax = MOVSX64rm32 %rcx, 4, killed %rax, 0, _ :: (load 4 from jump-table, align 8)
354 %rax = MOVSX64rm32 %rcx, 4, killed %rax, 0, _ :: (load 4 from jump-table, align 8)
355 %rax = ADD64rr killed %rax, killed %rcx, implicit-def dead %eflags
359 %eax = MOV32r0 implicit-def dead %eflags
380 tracksRegLiveness: true
383 %rax = MOV64rm %rip, 1, _, @a, _ :: (load 8 from got)
384 ; CHECK-LABEL: name: tbaa_metadata
385 ; CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from %ir.a, !tbaa !2)
386 ; CHECK-NEXT: %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.total_len2, !tbaa !6)
387 %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from %ir.a, !tbaa !2)
388 %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.total_len2, !tbaa !6)
393 tracksRegLiveness: true
400 ; CHECK-LABEL: name: aa_scope
401 ; CHECK: %xmm0 = MOVSSrm %rsi, 1, _, 0, _ :: (load 4 from %ir.c, !alias.scope !9)
402 %xmm0 = MOVSSrm %rsi, 1, _, 0, _ :: (load 4 from %ir.c, !alias.scope !9)
403 MOVSSmr %rdi, 1, _, 20, _, killed %xmm0 :: (store 4 into %ir.arrayidx.i)
404 %xmm0 = MOVSSrm killed %rsi, 1, _, 0, _ :: (load 4 from %ir.c)
405 MOVSSmr killed %rdi, 1, _, 28, _, killed %xmm0 :: (store 4 into %ir.arrayidx)