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-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
|
|
|
|
...
|