MIR Serialization: Serialize global address machine operands.
[oota-llvm.git] / test / CodeGen / MIR / X86 / global-value-operands.mir
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 global value operands correctly.
3
4 --- |
5
6   @G = external global i32
7   @0 = external global i32
8
9   define i32 @inc() {
10   entry:
11     %a = load i32, i32* @G
12     %b = add i32 %a, 1
13     ret i32 %b
14   }
15
16   define i32 @inc2() {
17   entry:
18     %a = load i32, i32* @0
19     %b = add i32 %a, 1
20     ret i32 %b
21   }
22
23 ...
24 ---
25 # CHECK: name: inc
26 name: inc
27 body:
28   - id: 0
29     name: entry
30     instructions:
31       # CHECK: - '%rax = MOV64rm %rip, 1, _, @G, _'
32       - '%rax = MOV64rm %rip, 1, _, @G, _'
33       - '%eax = MOV32rm %rax, 1, _, 0, _'
34       - '%eax = INC32r %eax'
35       - 'RETQ %eax'
36 ...
37 ---
38 # CHECK: name: inc2
39 name: inc2
40 body:
41   - id: 0
42     name: entry
43     instructions:
44       # CHECK: - '%rax = MOV64rm %rip, 1, _, @0, _'
45       - '%rax = MOV64rm %rip, 1, _, @0, _'
46       - '%eax = MOV32rm %rax, 1, _, 0, _'
47       - '%eax = INC32r %eax'
48       - 'RETQ %eax'
49 ...