diff options
author | JF Bastien <jfb@google.com> | 2015-08-31 22:24:11 +0000 |
---|---|---|
committer | JF Bastien <jfb@google.com> | 2015-08-31 22:24:11 +0000 |
commit | 73ff6afa87f0e5b162af37edd60b8f76035e72be (patch) | |
tree | 11e069866ab7d236f2ccf79318b09009f8001103 /llvm/test/CodeGen/WebAssembly/load-ext.ll | |
parent | 3b0b43c8c6fefdac69d51279d63d106f296a7c7a (diff) | |
download | bcm5719-llvm-73ff6afa87f0e5b162af37edd60b8f76035e72be.tar.gz bcm5719-llvm-73ff6afa87f0e5b162af37edd60b8f76035e72be.zip |
WebAssembly: generate load/store
Summary: This handles all load/store operations that WebAssembly defines, and handles those necessary for C++ such as i1. I left a FIXME for outstanding features which aren't required for now.
Reviewers: sunfish
Subscribers: jfb, llvm-commits, dschuff
llvm-svn: 246500
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/load-ext.ll')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/load-ext.ll | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/load-ext.ll b/llvm/test/CodeGen/WebAssembly/load-ext.ll new file mode 100644 index 00000000000..b673cfb1919 --- /dev/null +++ b/llvm/test/CodeGen/WebAssembly/load-ext.ll @@ -0,0 +1,86 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that extending loads are assembled properly. + +target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +; CHECK-LABEL: (func $sext_i8_i32 +; CHECK: (setlocal @1 (load_sx_i8_i32 @0)) +define i32 @sext_i8_i32(i8 *%p) { + %v = load i8, i8* %p + %e = sext i8 %v to i32 + ret i32 %e +} + +; CHECK-LABEL: (func $zext_i8_i32 +; CHECK: (setlocal @1 (load_zx_i8_i32 @0)) +define i32 @zext_i8_i32(i8 *%p) { + %v = load i8, i8* %p + %e = zext i8 %v to i32 + ret i32 %e +} + +; CHECK-LABEL: (func $sext_i16_i32 +; CHECK: (setlocal @1 (load_sx_i16_i32 @0)) +define i32 @sext_i16_i32(i16 *%p) { + %v = load i16, i16* %p + %e = sext i16 %v to i32 + ret i32 %e +} + +; CHECK-LABEL: (func $zext_i16_i32 +; CHECK: (setlocal @1 (load_zx_i16_i32 @0)) +define i32 @zext_i16_i32(i16 *%p) { + %v = load i16, i16* %p + %e = zext i16 %v to i32 + ret i32 %e +} + +; CHECK-LABEL: (func $sext_i8_i64 +; CHECK: (setlocal @1 (load_sx_i8_i64 @0)) +define i64 @sext_i8_i64(i8 *%p) { + %v = load i8, i8* %p + %e = sext i8 %v to i64 + ret i64 %e +} + +; CHECK-LABEL: (func $zext_i8_i64 +; CHECK: (setlocal @1 (load_zx_i8_i64 @0)) +define i64 @zext_i8_i64(i8 *%p) { + %v = load i8, i8* %p + %e = zext i8 %v to i64 + ret i64 %e +} + +; CHECK-LABEL: (func $sext_i16_i64 +; CHECK: (setlocal @1 (load_sx_i16_i64 @0)) +define i64 @sext_i16_i64(i16 *%p) { + %v = load i16, i16* %p + %e = sext i16 %v to i64 + ret i64 %e +} + +; CHECK-LABEL: (func $zext_i16_i64 +; CHECK: (setlocal @1 (load_zx_i16_i64 @0)) +define i64 @zext_i16_i64(i16 *%p) { + %v = load i16, i16* %p + %e = zext i16 %v to i64 + ret i64 %e +} + +; CHECK-LABEL: (func $sext_i32_i64 +; CHECK: (setlocal @1 (load_sx_i32_i64 @0)) +define i64 @sext_i32_i64(i32 *%p) { + %v = load i32, i32* %p + %e = sext i32 %v to i64 + ret i64 %e +} + +; CHECK-LABEL: (func $zext_i32_i64 +; CHECK: (setlocal @1 (load_zx_i32_i64 @0)) +define i64 @zext_i32_i64(i32 *%p) { + %v = load i32, i32* %p + %e = zext i32 %v to i64 + ret i64 %e +} |