1# RUN: llvm-mc -no-type-check -triple=wasm32-unknown-unknown -mattr=+exception-handling < %s | FileCheck %s
2
3# Tests if block/loop/try/catch/end/branch/rethrow instructions are correctly
4# printed with their annotations.
5
6  .text
7  .section .text.test_annotation,"",@
8  .type    test_annotation,@function
9test_annotation:
10  .functype   test_annotation () -> ()
11  .tagtype  __cpp_exception i32
12  try
13  br        0
14  catch     __cpp_exception
15  block
16  br_if     0
17  loop
18  br_if     1
19  end_loop
20  end_block
21  try
22  rethrow   0
23  catch     __cpp_exception
24  catch_all
25  block
26  try
27  br        0
28  try
29  delegate  1
30  catch_all
31  end_try
32  end_block
33  rethrow   0
34  end_try
35  end_try
36  end_function
37
38
39# CHECK:      test_annotation:
40# CHECK:        try
41# CHECK-NEXT:   br        0               # 0: down to label0
42# CHECK-NEXT:   catch     __cpp_exception # catch0:
43# CHECK-NEXT:   block
44# CHECK-NEXT:   br_if     0               # 0: down to label1
45# CHECK-NEXT:   loop                      # label2:
46# CHECK-NEXT:   br_if     1               # 1: down to label1
47# CHECK-NEXT:   end_loop
48# CHECK-NEXT:   end_block                 # label1:
49# CHECK-NEXT:   try
50# CHECK-NEXT:   rethrow   0               # down to catch3
51# CHECK-NEXT:   catch     __cpp_exception # catch3:
52# CHECK-NEXT:   catch_all{{$}}
53# CHECK-NEXT:   block
54# CHECK-NEXT:   try
55# CHECK-NEXT:   br        0               # 0: down to label5
56# CHECK-NEXT:   try
57# CHECK-NEXT:   delegate    1             # label/catch6: down to catch4
58# CHECK-NEXT:   catch_all                 # catch5:
59# CHECK-NEXT:   end_try                   # label5:
60# CHECK-NEXT:   end_block                 # label4:
61# CHECK-NEXT:   rethrow   0               # to caller
62# CHECK-NEXT:   end_try                   # label3:
63# CHECK-NEXT:   end_try                   # label0:
64# CHECK-NEXT:   end_function
65
66