blob: e0f72d2e503417517fec56432486aa276cfd0912 [file] [log] [blame]
Dan Gohmanc2853072015-09-03 22:51:53 +00001// RUN: %clang_cc1 -triple wasm32-unknown-unknown -O3 -emit-llvm -o - %s \
2// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY32
3// RUN: %clang_cc1 -triple wasm64-unknown-unknown -O3 -emit-llvm -o - %s \
4// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64
5
Dan Gohmand4c5fb52015-10-02 19:38:47 +00006__SIZE_TYPE__ f1(void) {
Derek Schuffdbd24b42016-05-02 17:26:19 +00007 return __builtin_wasm_current_memory();
8// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.current.memory.i32()
9// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.current.memory.i64()
Dan Gohmand4c5fb52015-10-02 19:38:47 +000010}
Dan Gohman266b38a2015-10-02 20:20:01 +000011
Dan Gohman0c595412017-01-18 01:03:35 +000012__SIZE_TYPE__ f2(__SIZE_TYPE__ delta) {
13 return __builtin_wasm_grow_memory(delta);
14// WEBASSEMBLY32: call i32 @llvm.wasm.grow.memory.i32(i32 %{{.*}})
15// WEBASSEMBLY64: call i64 @llvm.wasm.grow.memory.i64(i64 %{{.*}})
Dan Gohman266b38a2015-10-02 20:20:01 +000016}
Heejin Ahnb92440e2017-06-30 00:44:01 +000017
18void f3(unsigned int tag, void *obj) {
19 return __builtin_wasm_throw(tag, obj);
20// WEBASSEMBLY32: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}})
21// WEBASSEMBLY64: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}})
22}
23
24void f4() {
25 return __builtin_wasm_rethrow();
26// WEBASSEMBLY32: call void @llvm.wasm.rethrow()
27// WEBASSEMBLY64: call void @llvm.wasm.rethrow()
28}