Skip to content

[WebAssembly] Merge eh-assembly-legacy.s into eh-assembly.s #111411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions llvm/test/MC/WebAssembly/eh-assembly-legacy.s

This file was deleted.

90 changes: 90 additions & 0 deletions llvm/test/MC/WebAssembly/eh-assembly.s
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,58 @@ eh_test:
end_try_table
drop
drop
end_function

eh_legacy_test:
.functype eh_legacy_test () -> ()

# try-catch with catch, catch_all, throw, and rethrow
try
i32.const 3
throw __cpp_exception
catch __cpp_exception
drop
rethrow 0
catch __c_longjmp
drop
catch_all
rethrow 0
end_try

# Nested try-catch with a rethrow
try
call foo
catch_all
try
catch_all
rethrow 1
end_try
end_try

# try-catch with a single return value
try i32
i32.const 0
catch __cpp_exception
end_try
drop

# try-catch with a mulvivalue return
try () -> (i32, f32)
i32.const 0
f32.const 0.0
catch __cpp_exception
f32.const 1.0
end_try
drop
drop

# Catch-less try
try
call foo
end_try
end_function


# CHECK-LABEL: eh_test:
# CHECK: block exnref
# CHECK-NEXT: block
Expand Down Expand Up @@ -153,3 +202,44 @@ eh_test:
# CHECK-NEXT: end_try_table
# CHECK-NEXT: drop
# CHECK-NEXT: drop

# CHECK: eh_legacy_test:
# CHECK: try
# CHECK-NEXT: i32.const 3
# CHECK-NEXT: throw __cpp_exception
# CHECK-NEXT: catch __cpp_exception
# CHECK-NEXT: drop
# CHECK-NEXT: rethrow 0
# CHECK-NEXT: catch __c_longjmp
# CHECK-NEXT: drop
# CHECK-NEXT: catch_all
# CHECK-NEXT: rethrow 0
# CHECK-NEXT: end_try

# CHECK: try
# CHECK-NEXT: call foo
# CHECK-NEXT: catch_all
# CHECK-NEXT: try
# CHECK-NEXT: catch_all
# CHECK-NEXT: rethrow 1
# CHECK-NEXT: end_try
# CHECK-NEXT: end_try

# CHECK: try i32
# CHECK-NEXT: i32.const 0
# CHECK-NEXT: catch __cpp_exception
# CHECK-NEXT: end_try
# CHECK-NEXT: drop

# CHECK: try () -> (i32, f32)
# CHECK-NEXT: i32.const 0
# CHECK-NEXT: f32.const 0x0p0
# CHECK-NEXT: catch __cpp_exception
# CHECK-NEXT: f32.const 0x1p0
# CHECK-NEXT: end_try
# CHECK-NEXT: drop
# CHECK-NEXT: drop

# CHECK: try
# CHECK-NEXT: call foo
# CHECK-NEXT: end_try
Loading