Files
clang-p2996/llvm/test/MC/WebAssembly/basic-assembly.s
Wouter van Oortmerssen 8a9cb242fb [WebAssembly] Added default stack-only instruction mode for MC.
Summary:
Made it convert from register to stack based instructions, and removed the registers.
Fixes to related code that was expecting register based instructions.
Added the correct testing flag to all tests, depending on what the
format they were expecting so far.
Translated one test to stack format as example: reg-stackify-stack.ll

tested:
llvm-lit -v `find test -name WebAssembly`
unittests/MC/*

Reviewers: dschuff, sunfish

Subscribers: sbc100, jgravelle-google, eraman, aheejin, llvm-commits, jfb

Differential Revision: https://reviews.llvm.org/D51241

llvm-svn: 340750
2018-08-27 15:45:51 +00:00

85 lines
2.5 KiB
ArmAsm

# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+sign_ext,+simd128 < %s | FileCheck %s
.text
.type test0,@function
test0:
# Test all types:
.param i32, i64
.local f32, f64, v128, v128
# Explicit getlocal/setlocal:
get_local 2
set_local 2
# Immediates:
i32.const -1
f64.const 0x1.999999999999ap1
v128.const 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
v128.const 0, 1, 2, 3, 4, 5, 6, 7
# Indirect addressing:
get_local 0
f64.store 0
# Loops, conditionals, binary ops, calls etc:
block
i32.const 1
get_local 0
i32.ge_s
br_if 0 # 0: down to label0
.LBB0_1:
loop # label1:
call something1@FUNCTION
i64.const 1234
i32.call something2@FUNCTION
i32.const 0
call_indirect
i32.const 1
i32.add
tee_local 0
get_local 0
i32.lt_s
br_if 0 # 0: up to label1
.LBB0_2:
end_loop
end_block # label0:
get_local 4
get_local 5
f32x4.add
end_function
# CHECK: .text
# CHECK-LABEL: test0:
# CHECK-NEXT: .param i32, i64
# CHECK-NEXT: .local f32, f64
# CHECK-NEXT: get_local 2
# CHECK-NEXT: set_local 2
# CHECK-NEXT: i32.const -1
# CHECK-NEXT: f64.const 0x1.999999999999ap1
# CHECK-NEXT: v128.const 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
# CHECK-NEXT: v128.const 0, 1, 2, 3, 4, 5, 6, 7
# CHECK-NEXT: get_local 0
# CHECK-NEXT: f64.store 0:p2align=0
# CHECK-NEXT: block
# CHECK-NEXT: i32.const 1
# CHECK-NEXT: get_local 0
# CHECK-NEXT: i32.ge_s
# CHECK-NEXT: br_if 0 # 0: down to label0
# CHECK-NEXT: .LBB0_1:
# CHECK-NEXT: loop # label1:
# CHECK-NEXT: call something1@FUNCTION
# CHECK-NEXT: i64.const 1234
# CHECK-NEXT: i32.call something2@FUNCTION
# CHECK-NEXT: i32.const 0
# CHECK-NEXT: call_indirect
# CHECK-NEXT: i32.const 1
# CHECK-NEXT: i32.add
# CHECK-NEXT: tee_local 0
# CHECK-NEXT: get_local 0
# CHECK-NEXT: i32.lt_s
# CHECK-NEXT: br_if 0 # 0: up to label1
# CHECK-NEXT: .LBB0_2:
# CHECK-NEXT: end_loop
# CHECK-NEXT: end_block # label0:
# CHECK-NEXT: get_local 4
# CHECK-NEXT: get_local 5
# CHECK-NEXT: f32x4.add
# CHECK-NEXT: end_function