blob: 3c1173aaac32ee05f1871084c453ea0ab0a1fcfe [file] [log] [blame]
Dan Gohman69c4c762015-08-24 21:03:24 +00001; RUN: llc < %s -asm-verbose=false | FileCheck %s
2
3; Test that basic memory operations assemble as expected with 32-bit addresses.
4
5target datalayout = "e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown"
7
8declare i32 @llvm.wasm.page.size.i32() nounwind readnone
Dan Gohman72f16922015-10-02 19:21:15 +00009declare i32 @llvm.wasm.memory.size.i32() nounwind readnone
Dan Gohman69c4c762015-08-24 21:03:24 +000010
JF Bastienb6091df2015-08-25 22:58:05 +000011; CHECK-LABEL: (func $page_size
12; CHECK-NEXT: (result i32)
Dan Gohman69c4c762015-08-24 21:03:24 +000013; CHECK-NEXT: (setlocal @0 (page_size))
14; CHECK-NEXT: (return @0)
15define i32 @page_size() {
16 %a = call i32 @llvm.wasm.page.size.i32()
17 ret i32 %a
18}
Dan Gohman72f16922015-10-02 19:21:15 +000019
20; CHECK-LABEL: (func $memory_size
21; CHECK-NEXT: (result i32)
22; CHECK-NEXT: (setlocal @0 (memory_size))
23; CHECK-NEXT: (return @0)
24define i32 @memory_size() {
25 %a = call i32 @llvm.wasm.memory.size.i32()
26 ret i32 %a
27}