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

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 15:06:16 PDT 2024


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

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

>From 61a1d3e4a6ef200eb24d16bf51f00ca1383fda7f Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Fri, 13 Sep 2024 01:37:34 +0000
Subject: [PATCH] [WebAssembly] Add more EH assembly test cases

This adds assembly tests for a catch-less `try` and a `try` with a
multivalue return.
---
 llvm/test/MC/WebAssembly/eh-assembly.s | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

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
+



More information about the llvm-commits mailing list