2016-05-21 08:21:56 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s
|
2015-08-25 05:03:24 +08:00
|
|
|
|
|
|
|
; Test that basic memory operations assemble as expected with 32-bit addresses.
|
|
|
|
|
2016-01-07 11:19:23 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2015-08-25 05:03:24 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
|
2016-05-03 01:25:22 +08:00
|
|
|
declare i32 @llvm.wasm.current.memory.i32() nounwind readonly
|
2015-11-06 04:16:59 +08:00
|
|
|
declare void @llvm.wasm.grow.memory.i32(i32) nounwind
|
2015-10-03 03:21:15 +08:00
|
|
|
|
2016-05-03 01:25:22 +08:00
|
|
|
; CHECK-LABEL: current_memory:
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .result i32{{$}}
|
2016-05-03 01:25:22 +08:00
|
|
|
; CHECK-NEXT: current_memory $push0={{$}}
|
2015-11-26 00:55:01 +08:00
|
|
|
; CHECK-NEXT: return $pop0{{$}}
|
2016-05-03 01:25:22 +08:00
|
|
|
define i32 @current_memory() {
|
|
|
|
%a = call i32 @llvm.wasm.current.memory.i32()
|
2015-10-03 03:21:15 +08:00
|
|
|
ret i32 %a
|
|
|
|
}
|
2015-10-03 04:10:26 +08:00
|
|
|
|
2015-11-06 04:16:59 +08:00
|
|
|
; CHECK-LABEL: grow_memory:
|
2015-11-26 01:33:15 +08:00
|
|
|
; CHECK-NEXT: .param i32{{$}}
|
2015-11-19 00:12:01 +08:00
|
|
|
; CHECK: grow_memory $0{{$}}
|
|
|
|
; CHECK-NEXT: return{{$}}
|
2015-11-06 04:16:59 +08:00
|
|
|
define void @grow_memory(i32 %n) {
|
|
|
|
call void @llvm.wasm.grow.memory.i32(i32 %n)
|
2015-10-03 04:10:26 +08:00
|
|
|
ret void
|
|
|
|
}
|