1# RUN: llc -march=x86-64 -run-pass none -o - %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 @.$0 = external global i32 24 @-_- = external global i32 25 @_-_a = external global i32 26 @$.-B = external global i32 27 28 define i32 @test() { 29 entry: 30 %a = load i32, i32* @.$0 31 store i32 %a, i32* @-_- 32 %b = load i32, i32* @_-_a 33 store i32 %b, i32* @$.-B 34 ret i32 %b 35 } 36 37 @"\01Hello@$%09 \\ World," = external global i32 38 39 define i32 @test2() { 40 entry: 41 %a = load i32, i32* @"\01Hello@$%09 \\ World," 42 ret i32 %a 43 } 44 45 define i32 @test3() { 46 entry: 47 %a = load i32, i32* @.$0 48 store i32 %a, i32* @-_- 49 %b = load i32, i32* @_-_a 50 store i32 %b, i32* @$.-B 51 ret i32 %b 52 } 53 54 define i32 @tf() { 55 entry: 56 %a = load i32, i32* @G 57 %b = add i32 %a, 1 58 ret i32 %b 59 } 60 61... 62--- 63# CHECK: name: inc 64name: inc 65body: | 66 bb.0.entry: 67 ; CHECK: $rax = MOV64rm $rip, 1, $noreg, @G, $noreg 68 $rax = MOV64rm $rip, 1, _, @G, _ 69 $eax = MOV32rm $rax, 1, _, 0, _ 70 $eax = INC32r $eax, implicit-def $eflags 71 RETQ $eax 72... 73--- 74# CHECK: name: inc2 75name: inc2 76body: | 77 bb.0.entry: 78 ; CHECK: $rax = MOV64rm $rip, 1, $noreg, @0, $noreg 79 $rax = MOV64rm $rip, 1, _, @0, _ 80 $eax = MOV32rm $rax, 1, _, 0, _ 81 $eax = INC32r $eax, implicit-def $eflags 82 RETQ $eax 83... 84--- 85name: test 86body: | 87 bb.0.entry: 88 ; CHECK: , @".$0", 89 ; CHECK: , @-_-, 90 ; CHECK: , @_-_a, 91 ; CHECK: , @"$.-B", 92 $rax = MOV64rm $rip, 1, _, @.$0, _ 93 $eax = MOV32rm killed $rax, 1, _, 0, _ 94 $rcx = MOV64rm $rip, 1, _, @-_-, _ 95 MOV32mr killed $rcx, 1, _, 0, _, killed $eax 96 $rax = MOV64rm $rip, 1, _, @_-_a, _ 97 $eax = MOV32rm killed $rax, 1, _, 0, _ 98 $rcx = MOV64rm $rip, 1, _, @$.-B, _ 99 MOV32mr killed $rcx, 1, _, 0, _, $eax 100 RETQ $eax 101... 102--- 103name: test2 104body: | 105 bb.0.entry: 106 ; CHECK: , @"\01Hello@$%09 \\ World,", 107 $rax = MOV64rm $rip, 1, _, @"\01Hello@$%09 \\ World,", _ 108 $eax = MOV32rm killed $rax, 1, _, 0, _ 109 RETQ $eax 110... 111--- 112# CHECK: name: test3 113name: test3 114body: | 115 bb.0.entry: 116 ; CHECK: , @".$0", 117 ; CHECK: , @-_-, 118 ; CHECK: , @_-_a + 4, 119 ; CHECK: , @"$.-B" - 8, 120 $rax = MOV64rm $rip, 1, _, @.$0 + 0, _ 121 $eax = MOV32rm killed $rax, 1, _, 0, _ 122 $rcx = MOV64rm $rip, 1, _, @-_- - 0, _ 123 MOV32mr killed $rcx, 1, _, 0, _, killed $eax 124 $rax = MOV64rm $rip, 1, _, @_-_a + 4, _ 125 $eax = MOV32rm killed $rax, 1, _, 0, _ 126 $rcx = MOV64rm $rip, 1, _, @$.-B - 8, _ 127 MOV32mr killed $rcx, 1, _, 0, _, $eax 128 RETQ $eax 129... 130--- 131# CHECK: name: tf 132name: tf 133body: | 134 bb.0.entry: 135 ; CHECK: $rax = MOV64rm $rip, 1, $noreg, target-flags(x86-gotpcrel) @G, $noreg 136 $rax = MOV64rm $rip, 1, _, target-flags(x86-gotpcrel) @G, _ 137 $eax = MOV32rm $rax, 1, _, 0, _ 138 $eax = INC32r $eax, implicit-def $eflags 139 RETQ $eax 140... 141