1 # RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s
2 # This test ensures that the MIR parser parses the block address operands
7 @addr = global i8* null
11 store volatile i8* blockaddress(@test, %block), i8** @addr
12 %val = load volatile i8*, i8** @addr
13 indirectbr i8* %val, [label %block]
19 define void @test2() {
21 store volatile i8* blockaddress(@test2, %"quoted block"), i8** @addr
22 %val = load volatile i8*, i8** @addr
23 indirectbr i8* %val, [label %"quoted block"]
29 define void @slot_in_other_function(i8** %addr) {
31 store volatile i8* blockaddress(@test3, %0), i8** %addr
35 define void @test3() {
37 store volatile i8* blockaddress(@test3, %0), i8** @addr
38 %val = load volatile i8*, i8** @addr
39 indirectbr i8* %val, [label %0]
44 define void @test4() {
46 store volatile i8* blockaddress(@test4, %block), i8** @addr
47 %val = load volatile i8*, i8** @addr
48 indirectbr i8* %val, [label %block]
59 successors: %bb.1.block
60 ; CHECK: $rax = LEA64r $rip, 1, $noreg, blockaddress(@test, %ir-block.block), $noreg
61 $rax = LEA64r $rip, 1, _, blockaddress(@test, %ir-block.block), _
62 MOV64mr $rip, 1, _, @addr, _, killed $rax
63 JMP64m $rip, 1, _, @addr, _
65 bb.1.block (address-taken):
70 tracksRegLiveness: true
74 ; CHECK: $rax = LEA64r $rip, 1, $noreg, blockaddress(@test2, %ir-block."quoted block"), $noreg
75 $rax = LEA64r $rip, 1, _, blockaddress(@test2, %ir-block."quoted block"), _
76 MOV64mr $rip, 1, _, @addr, _, killed $rax
77 JMP64m $rip, 1, _, @addr, _
83 name: slot_in_other_function
84 tracksRegLiveness: true
88 ; CHECK-LABEL: name: slot_in_other_function
89 ; CHECK: $rax = LEA64r $rip, 1, $noreg, blockaddress(@test3, %ir-block.0), $noreg
90 $rax = LEA64r $rip, 1, _, blockaddress(@test3, %ir-block.0), _
91 MOV64mr killed $rdi, 1, _, 0, _, killed $rax
96 tracksRegLiveness: true
100 ; CHECK-LABEL: name: test3
101 ; CHECK: $rax = LEA64r $rip, 1, $noreg, blockaddress(@test3, %ir-block.0), $noreg
102 $rax = LEA64r $rip, 1, _, blockaddress(@test3, %ir-block.0), _
103 MOV64mr $rip, 1, _, @addr, _, killed $rax
104 JMP64m $rip, 1, _, @addr, _
106 bb.1 (address-taken):
113 successors: %bb.1.block
114 ; CHECK: $rax = LEA64r $rip, 1, $noreg, blockaddress(@test, %ir-block.block) + 2, $noreg
115 $rax = LEA64r $rip, 1, _, blockaddress(@test, %ir-block.block) + 2, _
116 MOV64mr $rip, 1, _, @addr, _, killed $rax
117 JMP64m $rip, 1, _, @addr, _
119 bb.1.block (address-taken):