aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/builtins-wasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/builtins-wasm.c')
-rw-r--r--test/CodeGen/builtins-wasm.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/test/CodeGen/builtins-wasm.c b/test/CodeGen/builtins-wasm.c
index 4f14e901ed..4784d6ff86 100644
--- a/test/CodeGen/builtins-wasm.c
+++ b/test/CodeGen/builtins-wasm.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
-// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
-// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
+// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
// SIMD convenience types
typedef char i8x16 __attribute((vector_size(16)));
@@ -26,16 +26,28 @@ __SIZE_TYPE__ memory_grow(__SIZE_TYPE__ delta) {
// WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}})
}
-void throw(unsigned int tag, void *obj) {
- return __builtin_wasm_throw(tag, obj);
- // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}})
- // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}})
+void memory_init(void *dest, int offset, int size) {
+ __builtin_wasm_memory_init(3, 0, dest, offset, size);
+ // WEBASSEMBLY32: call void @llvm.wasm.memory.init(i32 3, i32 0, i8* %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
+ // WEBASSEMBLY64: call void @llvm.wasm.memory.init(i32 3, i32 0, i8* %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
}
-void rethrow(void) {
- return __builtin_wasm_rethrow();
- // WEBASSEMBLY32: call void @llvm.wasm.rethrow()
- // WEBASSEMBLY64: call void @llvm.wasm.rethrow()
+void data_drop() {
+ __builtin_wasm_data_drop(3);
+ // WEBASSEMBLY32: call void @llvm.wasm.data.drop(i32 3)
+ // WEBASSEMBLY64: call void @llvm.wasm.data.drop(i32 3)
+}
+
+void throw(void *obj) {
+ return __builtin_wasm_throw(0, obj);
+ // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
+ // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
+}
+
+void rethrow_in_catch(void) {
+ return __builtin_wasm_rethrow_in_catch();
+ // WEBASSEMBLY32: call void @llvm.wasm.rethrow.in.catch()
+ // WEBASSEMBLY64: call void @llvm.wasm.rethrow.in.catch()
}
int atomic_wait_i32(int *addr, int expected, long long timeout) {