Skip to content

Commit e7c67a6

Browse files
committed
[EH] Create separate file for EH assembly tests
Create `eh-assembly.s` that contains EH tests and remove EH tests from `basic-assembly.s`, given that it's easier to manage. (We can have many different tests, including the legacy EH and the new exnref, and with nesting for readability)
1 parent 6bbf7f0 commit e7c67a6

File tree

2 files changed

+67
-12
lines changed

2 files changed

+67
-12
lines changed

llvm/test/MC/WebAssembly/basic-assembly.s

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+tail-call,+reference-types,atomics,+simd128,+nontrapping-fptoint,+exception-handling < %s | FileCheck %s
1+
# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+tail-call,+reference-types,atomics,+simd128,+nontrapping-fptoint < %s | FileCheck %s
22
# Check that it converts to .o without errors, but don't check any output:
3-
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+tail-call,+reference-types,+atomics,+simd128,+nontrapping-fptoint,+exception-handling -o %t.o < %s
3+
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+tail-call,+reference-types,+atomics,+simd128,+nontrapping-fptoint -o %t.o < %s
44

55
.functype something1 () -> ()
66
.functype something2 (i64) -> (i32, f64)
@@ -107,19 +107,14 @@ test0:
107107
#i32x4.trunc_sat_f32x4_s
108108
f32.const 1.0
109109
i32.trunc_f32_s
110-
try
111110
i32.atomic.load 0
112111
i32.const 0
113112
memory.atomic.notify 0
114113
drop
115114
.LBB0_3:
116-
catch __cpp_exception
117-
local.set 0
118-
end_try
119115
i32.const .L.str
120116
i32.load8_u .L.str+2
121117
i32.load16_u .L.str:p2align=0
122-
throw 0
123118
.LBB0_4:
124119
#i32.trunc_sat_f32_s
125120
global.get __stack_pointer
@@ -249,19 +244,14 @@ empty_exnref_table:
249244
# CHECK-NEXT: drop
250245
# CHECK-NEXT: f32.const 0x1p0
251246
# CHECK-NEXT: i32.trunc_f32_s
252-
# CHECK-NEXT: try
253247
# CHECK-NEXT: i32.atomic.load 0
254248
# CHECK-NEXT: i32.const 0
255249
# CHECK-NEXT: memory.atomic.notify 0
256250
# CHECK-NEXT: drop
257251
# CHECK-NEXT: .LBB0_3:
258-
# CHECK-NEXT: catch __cpp_exception
259-
# CHECK-NEXT: local.set 0
260-
# CHECK-NEXT: end_try
261252
# CHECK-NEXT: i32.const .L.str
262253
# CHECK-NEXT: i32.load8_u .L.str+2
263254
# CHECK-NEXT: i32.load16_u .L.str:p2align=0
264-
# CHECK-NEXT: throw 0
265255
# CHECK-NEXT: .LBB0_4:
266256
# CHECK-NEXT: global.get __stack_pointer
267257
# CHECK-NEXT: global.set __stack_pointer
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+exception-handling < %s | FileCheck %s
2+
# Check that it converts to .o without errors, but don't check any output:
3+
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -mattr=+exception-handling -o %t.o < %s
4+
5+
.tagtype __cpp_exception i32
6+
.tagtype __c_longjmp i32
7+
.functype eh_legacy_test () -> ()
8+
.functype foo () -> ()
9+
10+
eh_legacy_test:
11+
# try-catch with catch, catch_all, throw, and rethrow
12+
try
13+
throw __cpp_exception
14+
catch __cpp_exception
15+
drop
16+
rethrow 0
17+
catch __c_longjmp
18+
drop
19+
catch_all
20+
rethrow 0
21+
end_try
22+
23+
# try-catch with a return value
24+
try i32
25+
i32.const 0
26+
catch __cpp_exception
27+
end_try
28+
drop
29+
30+
# Nested try-catch with a rethrow
31+
try
32+
call foo
33+
catch_all
34+
try
35+
catch_all
36+
rethrow 1
37+
end_try
38+
end_try
39+
end_function
40+
41+
# CHECK-LABEL: eh_legacy_test:
42+
# CHECK-NEXT: try
43+
# CHECK-NEXT: throw __cpp_exception
44+
# CHECK-NEXT: catch __cpp_exception
45+
# CHECK-NEXT: drop
46+
# CHECK-NEXT: rethrow 0
47+
# CHECK-NEXT: catch __c_longjmp
48+
# CHECK-NEXT: drop
49+
# CHECK-NEXT: catch_all
50+
# CHECK-NEXT: rethrow 0
51+
# CHECK-NEXT: end_try
52+
# CHECK: try i32
53+
# CHECK-NEXT: i32.const 0
54+
# CHECK-NEXT: catch __cpp_exception
55+
# CHECK-NEXT: end_try
56+
# CHECK-NEXT: drop
57+
# CHECK: try
58+
# CHECK-NEXT: call foo
59+
# CHECK-NEXT: catch_all
60+
# CHECK-NEXT: try
61+
# CHECK-NEXT: catch_all
62+
# CHECK-NEXT: rethrow 1
63+
# CHECK-NEXT: end_try
64+
# CHECK-NEXT: end_try
65+
# CHECK-NEXT: end_function

0 commit comments

Comments
 (0)