2015-08-04 07:08:19 +08:00
|
|
|
# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
|
|
|
|
# This test ensures that the MIR parser parses the machine memory operands
|
|
|
|
# correctly.
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
define i32 @test(i32* %a) {
|
|
|
|
entry:
|
|
|
|
%b = load i32, i32* %a
|
|
|
|
store i32 42, i32* %a
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test2(i32* %"a value") {
|
|
|
|
entry2:
|
|
|
|
%b = load i32, i32* %"a value"
|
|
|
|
%c = add i32 %b, 1
|
|
|
|
store i32 %c, i32* %"a value"
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-08-04 08:24:45 +08:00
|
|
|
define i32 @volatile_inc(i32* %x) {
|
|
|
|
entry:
|
|
|
|
%0 = load volatile i32, i32* %x
|
|
|
|
%1 = add i32 %0, 1
|
|
|
|
store volatile i32 %1, i32* %x
|
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
2015-08-07 00:49:30 +08:00
|
|
|
define void @non_temporal_store(i32* %a, i32 %b) {
|
|
|
|
entry:
|
|
|
|
store i32 %b, i32* %a, align 16, !nontemporal !0
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
!0 = !{i32 1}
|
|
|
|
|
2015-08-07 00:55:53 +08:00
|
|
|
define i32 @invariant_load(i32* %x) {
|
|
|
|
entry:
|
|
|
|
%v = load i32, i32* %x, !invariant.load !1
|
|
|
|
ret i32 %v
|
|
|
|
}
|
|
|
|
|
|
|
|
!1 = !{}
|
|
|
|
|
2015-08-08 04:26:52 +08:00
|
|
|
define void @memory_offset(<8 x float>* %vec) {
|
|
|
|
entry:
|
|
|
|
%v = load <8 x float>, <8 x float>* %vec
|
|
|
|
%v2 = insertelement <8 x float> %v, float 0.0, i32 4
|
|
|
|
store <8 x float> %v2, <8 x float>* %vec
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-08-08 04:48:30 +08:00
|
|
|
define void @memory_alignment(<8 x float>* %vec) {
|
|
|
|
entry:
|
|
|
|
%v = load <8 x float>, <8 x float>* %vec
|
|
|
|
%v2 = insertelement <8 x float> %v, float 0.0, i32 4
|
|
|
|
store <8 x float> %v2, <8 x float>* %vec
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-08-13 04:33:26 +08:00
|
|
|
define double @constant_pool_psv(double %a) {
|
|
|
|
entry:
|
|
|
|
%b = fadd double %a, 3.250000e+00
|
|
|
|
ret double %b
|
|
|
|
}
|
|
|
|
|
2015-08-13 04:44:16 +08:00
|
|
|
declare x86_fp80 @cosl(x86_fp80) #0
|
|
|
|
|
|
|
|
define x86_fp80 @stack_psv(x86_fp80 %x) {
|
|
|
|
entry:
|
|
|
|
%y = call x86_fp80 @cosl(x86_fp80 %x) #0
|
|
|
|
ret x86_fp80 %y
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { readonly }
|
|
|
|
|
2015-08-04 07:08:19 +08:00
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: %eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)
|
|
|
|
# CHECK-NEXT: MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)
|
|
|
|
- '%eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)'
|
|
|
|
- 'MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)'
|
|
|
|
- 'RETQ %eax'
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test2
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry2
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")
|
|
|
|
- 'INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")'
|
|
|
|
- RETQ
|
|
|
|
...
|
2015-08-04 08:24:45 +08:00
|
|
|
---
|
|
|
|
name: volatile_inc
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: volatile_inc
|
|
|
|
# CHECK: %eax = MOV32rm %rdi, 1, _, 0, _ :: (volatile load 4 from %ir.x)
|
|
|
|
# CHECK: MOV32mr killed %rdi, 1, _, 0, _, %eax :: (volatile store 4 into %ir.x)
|
|
|
|
- '%eax = MOV32rm %rdi, 1, _, 0, _ :: (volatile load 4 from %ir.x)'
|
|
|
|
- '%eax = INC32r killed %eax, implicit-def dead %eflags'
|
|
|
|
- 'MOV32mr killed %rdi, 1, _, 0, _, %eax :: (volatile store 4 into %ir.x)'
|
|
|
|
- 'RETQ %eax'
|
|
|
|
...
|
2015-08-07 00:49:30 +08:00
|
|
|
---
|
|
|
|
name: non_temporal_store
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
- { reg: '%esi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%esi', '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: non_temporal_store
|
|
|
|
# CHECK: MOVNTImr killed %rdi, 1, _, 0, _, killed %esi :: (non-temporal store 4 into %ir.a)
|
|
|
|
- 'MOVNTImr killed %rdi, 1, _, 0, _, killed %esi :: (non-temporal store 4 into %ir.a)'
|
|
|
|
- RETQ
|
|
|
|
...
|
2015-08-07 00:55:53 +08:00
|
|
|
---
|
|
|
|
name: invariant_load
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: invariant_load
|
|
|
|
# CHECK: %eax = MOV32rm killed %rdi, 1, _, 0, _ :: (invariant load 4 from %ir.x)
|
|
|
|
- '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (invariant load 4 from %ir.x)'
|
|
|
|
- 'RETQ %eax'
|
|
|
|
...
|
2015-08-08 04:26:52 +08:00
|
|
|
---
|
|
|
|
name: memory_offset
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: memory_offset
|
|
|
|
# CHECK: %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)
|
|
|
|
# CHECK-NEXT: %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)
|
|
|
|
# CHECK: MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)
|
|
|
|
# CHECK-NEXT: MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)
|
|
|
|
- '%xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)'
|
|
|
|
- '%xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)'
|
|
|
|
- '%xmm2 = FsFLD0SS'
|
|
|
|
- '%xmm1 = MOVSSrr killed %xmm1, killed %xmm2'
|
|
|
|
- 'MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)'
|
|
|
|
- 'MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)'
|
|
|
|
- RETQ
|
|
|
|
...
|
2015-08-08 04:48:30 +08:00
|
|
|
---
|
|
|
|
name: memory_alignment
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%rdi' }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%rdi' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: memory_alignment
|
|
|
|
# CHECK: %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec, align 32)
|
|
|
|
# CHECK-NEXT: %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16, align 32)
|
|
|
|
# CHECK: MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec, align 32)
|
|
|
|
# CHECK-NEXT: MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16, align 32)
|
|
|
|
- '%xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec, align 32)'
|
|
|
|
- '%xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16, align 32)'
|
|
|
|
- '%xmm2 = FsFLD0SS'
|
|
|
|
- '%xmm1 = MOVSSrr killed %xmm1, killed %xmm2'
|
|
|
|
- 'MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec, align 32)'
|
|
|
|
- 'MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16, align 32)'
|
|
|
|
- RETQ
|
|
|
|
...
|
2015-08-13 04:33:26 +08:00
|
|
|
---
|
|
|
|
name: constant_pool_psv
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
|
|
|
- { reg: '%xmm0' }
|
|
|
|
constants:
|
|
|
|
- id: 0
|
|
|
|
value: 'double 3.250000e+00'
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
liveins: [ '%xmm0' ]
|
|
|
|
instructions:
|
|
|
|
# CHECK: name: constant_pool_psv
|
|
|
|
# CHECK: %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool)
|
|
|
|
# CHECK-NEXT: %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool + 8)
|
|
|
|
- '%xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool)'
|
|
|
|
- '%xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _ :: (load 8 from constant-pool + 8)'
|
|
|
|
- 'RETQ %xmm0'
|
|
|
|
...
|
2015-08-13 04:44:16 +08:00
|
|
|
---
|
|
|
|
name: stack_psv
|
|
|
|
tracksRegLiveness: true
|
|
|
|
frameInfo:
|
|
|
|
stackSize: 24
|
|
|
|
maxAlignment: 16
|
|
|
|
adjustsStack: true
|
|
|
|
hasCalls: true
|
|
|
|
maxCallFrameSize: 16
|
|
|
|
fixedStack:
|
|
|
|
- { id: 0, offset: 0, size: 10, alignment: 16, isImmutable: true, isAliased: false }
|
|
|
|
body:
|
|
|
|
- id: 0
|
|
|
|
name: entry
|
|
|
|
instructions:
|
|
|
|
- '%rsp = frame-setup SUB64ri8 %rsp, 24, implicit-def dead %eflags'
|
|
|
|
- CFI_INSTRUCTION .cfi_def_cfa_offset 32
|
|
|
|
- 'LD_F80m %rsp, 1, _, 32, _, implicit-def dead %fpsw'
|
|
|
|
# CHECK: name: stack_psv
|
|
|
|
# CHECK: ST_FP80m %rsp, 1, _, 0, _, implicit-def dead %fpsw :: (store 10 into stack, align 16)
|
|
|
|
- 'ST_FP80m %rsp, 1, _, 0, _, implicit-def dead %fpsw :: (store 10 into stack, align 16)'
|
|
|
|
- 'CALL64pcrel32 $cosl, csr_64, implicit %rsp, implicit-def %rsp, implicit-def %fp0'
|
|
|
|
- '%rsp = ADD64ri8 %rsp, 24, implicit-def dead %eflags'
|
|
|
|
- RETQ
|
|
|
|
...
|