[llvm] [WebAssembly] Add more EH assembly test cases (PR #108654)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 15:07:02 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-webassembly

Author: Heejin Ahn (aheejin)

<details>
<summary>Changes</summary>

This adds assembly tests for a catch-less `try` and a `try` with a multivalue return.

---
Full diff: https://github.com/llvm/llvm-project/pull/108654.diff


1 Files Affected:

- (modified) llvm/test/MC/WebAssembly/eh-assembly.s (+29) 


``````````diff
diff --git a/llvm/test/MC/WebAssembly/eh-assembly.s b/llvm/test/MC/WebAssembly/eh-assembly.s
index c84a65e55605cc..d31b66bed92302 100644
--- a/llvm/test/MC/WebAssembly/eh-assembly.s
+++ b/llvm/test/MC/WebAssembly/eh-assembly.s
@@ -36,6 +36,21 @@ eh_legacy_test:
   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_legacy_test:
@@ -64,4 +79,18 @@ eh_legacy_test:
 # 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
 # CHECK-NEXT:    end_function
+

``````````

</details>


https://github.com/llvm/llvm-project/pull/108654


More information about the llvm-commits mailing list