1; RUN:  llvm-dis < %s.bc | FileCheck %s --check-prefixes=CHECK,CHECK-TYPED
2; callbr.ll.bc was generated by passing this file to llvm-as.
3
4; RUN: llvm-as < %s | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-TYPED
5; RUN: llvm-as -opaque-pointers < %s | llvm-dis -opaque-pointers | FileCheck %s --check-prefixes=CHECK,CHECK-OPAQUE
6
7define i32 @test_asm_goto(i32 %x){
8entry:
9; CHECK-TYPED:      callbr void asm "", "r,i"(i32 %x, i8* blockaddress(@test_asm_goto, %fail))
10; CHECK-OPAQUE:     callbr void asm "", "r,i"(i32 %x, ptr blockaddress(@test_asm_goto, %fail))
11; CHECK-NEXT: to label %normal [label %fail]
12  callbr void asm "", "r,i"(i32 %x, i8* blockaddress(@test_asm_goto, %fail)) to label %normal [label %fail]
13normal:
14  ret i32 1
15fail:
16  ret i32 0
17}
18
19define i32 @test_asm_goto2(i32 %x){
20entry:
21; CHECK-TYPED:      callbr void asm "", "r,i,i"(i32 %x, i8* blockaddress(@test_asm_goto2, %fail), i8* blockaddress(@test_asm_goto2, %fail2))
22; CHECK-OPAQUE:     callbr void asm "", "r,i,i"(i32 %x, ptr blockaddress(@test_asm_goto2, %fail), ptr blockaddress(@test_asm_goto2, %fail2))
23; CHECK-NEXT: to label %normal [label %fail, label %fail2]
24  callbr void asm "", "r,i,i"(i32 %x, i8* blockaddress(@test_asm_goto2, %fail), i8* blockaddress(@test_asm_goto2, %fail2)) to label %normal [label %fail, label %fail2]
25normal:
26  ret i32 1
27fail:
28  ret i32 0
29fail2:
30  ret i32 2
31}
32
33define i32 @test_asm_goto3(i32 %x){
34entry:
35; CHECK-TYPED:      callbr void asm "", "r,i,i"(i32 %x, i8* blockaddress(@test_asm_goto3, %unrelated), i8* blockaddress(@test_asm_goto3, %fail))
36; CHECK-OPAQUE:     callbr void asm "", "r,i,i"(i32 %x, ptr blockaddress(@test_asm_goto3, %unrelated), ptr blockaddress(@test_asm_goto3, %fail))
37; CHECK-NEXT: to label %normal [label %fail]
38  callbr void asm "", "r,i,i"(i32 %x, i8* blockaddress(@test_asm_goto3, %unrelated), i8* blockaddress(@test_asm_goto3, %fail)) to label %normal [label %fail]
39normal:
40  ret i32 1
41fail:
42  ret i32 0
43unrelated:
44  ret i32 2
45}
46