moved crates in lib/ to src/, renamed crates, modified some files' text (#660)

moved crates in lib/ to src/, renamed crates, modified some files' text (#660)
This commit is contained in:
lazypassion
2019-01-28 18:56:54 -05:00
committed by Dan Gohman
parent 54959cf5bb
commit 747ad3c4c5
508 changed files with 94 additions and 92 deletions

View File

@@ -0,0 +1,65 @@
; Test basic code generation for control flow WebAssembly instructions.
test compile
target i686 haswell
target x86_64 haswell
function %br_if(i32) -> i32 {
ebb0(v0: i32):
v1 = iconst.i32 1
brz v0, ebb1(v1)
jump ebb2
ebb1(v2: i32):
return v2
ebb2:
jump ebb1(v0)
}
function %br_if_not(i32) -> i32 {
ebb0(v0: i32):
v1 = iconst.i32 1
brnz v0, ebb1(v0)
jump ebb2
ebb1(v2: i32):
return v2
ebb2:
jump ebb1(v0)
}
function %br_if_fallthrough(i32) -> i32 {
ebb0(v0: i32):
v1 = iconst.i32 1
brz v0, ebb1(v1)
; This jump gets converted to a fallthrough.
jump ebb1(v0)
ebb1(v2: i32):
return v2
}
function %undefined() {
ebb0:
trap user0
}
function %br_table(i32) {
jt0 = jump_table [ebb3, ebb1, ebb2]
ebb0(v0: i32):
br_table v0, ebb4, jt0
ebb4:
trap oob
ebb1:
return
ebb2:
return
ebb3:
return
}

View File

@@ -0,0 +1,202 @@
; Test code generation for WebAssembly type conversion operators.
test compile
target x86_64 haswell
function %i32_wrap_i64(i64) -> i32 {
ebb0(v0: i64):
v1 = ireduce.i32 v0
return v1
}
function %i64_extend_s_i32(i32) -> i64 {
ebb0(v0: i32):
v1 = sextend.i64 v0
return v1
}
function %i64_extend_u_i32(i32) -> i64 {
ebb0(v0: i32):
v1 = uextend.i64 v0
return v1
}
function %i32_trunc_s_f32(f32) -> i32 {
ebb0(v0: f32):
v1 = fcvt_to_sint.i32 v0
return v1
}
function %i32_trunc_u_f32(f32) -> i32 {
ebb0(v0: f32):
v1 = fcvt_to_uint.i32 v0
return v1
}
function %i32_trunc_s_f64(f64) -> i32 {
ebb0(v0: f64):
v1 = fcvt_to_sint.i32 v0
return v1
}
function %i32_trunc_u_f64(f64) -> i32 {
ebb0(v0: f64):
v1 = fcvt_to_uint.i32 v0
return v1
}
function %i64_trunc_s_f32(f32) -> i64 {
ebb0(v0: f32):
v1 = fcvt_to_sint.i64 v0
return v1
}
function %i64_trunc_u_f32(f32) -> i64 {
ebb0(v0: f32):
v1 = fcvt_to_uint.i64 v0
return v1
}
function %i64_trunc_s_f64(f64) -> i64 {
ebb0(v0: f64):
v1 = fcvt_to_sint.i64 v0
return v1
}
function %i64_trunc_u_f64(f64) -> i64 {
ebb0(v0: f64):
v1 = fcvt_to_uint.i64 v0
return v1
}
function %i32_trunc_s_sat_f32(f32) -> i32 {
ebb0(v0: f32):
v1 = fcvt_to_sint_sat.i32 v0
return v1
}
function %i32_trunc_u_sat_f32(f32) -> i32 {
ebb0(v0: f32):
v1 = fcvt_to_uint_sat.i32 v0
return v1
}
function %i32_trunc_s_sat_f64(f64) -> i32 {
ebb0(v0: f64):
v1 = fcvt_to_sint_sat.i32 v0
return v1
}
function %i32_trunc_u_sat_f64(f64) -> i32 {
ebb0(v0: f64):
v1 = fcvt_to_uint_sat.i32 v0
return v1
}
function %i64_trunc_s_sat_f32(f32) -> i64 {
ebb0(v0: f32):
v1 = fcvt_to_sint_sat.i64 v0
return v1
}
function %i64_trunc_u_sat_f32(f32) -> i64 {
ebb0(v0: f32):
v1 = fcvt_to_uint_sat.i64 v0
return v1
}
function %i64_trunc_s_sat_f64(f64) -> i64 {
ebb0(v0: f64):
v1 = fcvt_to_sint_sat.i64 v0
return v1
}
function %i64_trunc_u_sat_f64(f64) -> i64 {
ebb0(v0: f64):
v1 = fcvt_to_uint_sat.i64 v0
return v1
}
function %f32_trunc_f64(f64) -> f32 {
ebb0(v0: f64):
v1 = fdemote.f32 v0
return v1
}
function %f64_promote_f32(f32) -> f64 {
ebb0(v0: f32):
v1 = fpromote.f64 v0
return v1
}
function %f32_convert_s_i32(i32) -> f32 {
ebb0(v0: i32):
v1 = fcvt_from_sint.f32 v0
return v1
}
function %f32_convert_u_i32(i32) -> f32 {
ebb0(v0: i32):
v1 = fcvt_from_uint.f32 v0
return v1
}
function %f64_convert_s_i32(i32) -> f64 {
ebb0(v0: i32):
v1 = fcvt_from_sint.f64 v0
return v1
}
function %f64_convert_u_i32(i32) -> f64 {
ebb0(v0: i32):
v1 = fcvt_from_uint.f64 v0
return v1
}
function %f32_convert_s_i64(i64) -> f32 {
ebb0(v0: i64):
v1 = fcvt_from_sint.f32 v0
return v1
}
function %f32_convert_u_i64(i64) -> f32 {
ebb0(v0: i64):
v1 = fcvt_from_uint.f32 v0
return v1
}
function %f64_convert_s_i64(i64) -> f64 {
ebb0(v0: i64):
v1 = fcvt_from_sint.f64 v0
return v1
}
function %f64_convert_u_i64(i64) -> f64 {
ebb0(v0: i64):
v1 = fcvt_from_uint.f64 v0
return v1
}
function %i32_reinterpret_f32(f32) -> i32 {
ebb0(v0: f32):
v1 = bitcast.i32 v0
return v1
}
function %f32_reinterpret_i32(i32) -> f32 {
ebb0(v0: i32):
v1 = bitcast.f32 v0
return v1
}
function %i64_reinterpret_f64(f64) -> i64 {
ebb0(v0: f64):
v1 = bitcast.i64 v0
return v1
}
function %f64_reinterpret_i64(i64) -> f64 {
ebb0(v0: i64):
v1 = bitcast.f64 v0
return v1
}

View File

@@ -0,0 +1,103 @@
; Test basic code generation for f32 arithmetic WebAssembly instructions.
test compile
target i686 haswell
target i686 baseline
target x86_64 haswell
target x86_64 baseline
; Constants.
function %f32_const() -> f32 {
ebb0:
v1 = f32const 0x3.0
return v1
}
; Unary operations
function %f32_abs(f32) -> f32 {
ebb0(v0: f32):
v1 = fabs v0
return v1
}
function %f32_neg(f32) -> f32 {
ebb0(v0: f32):
v1 = fneg v0
return v1
}
function %f32_sqrt(f32) -> f32 {
ebb0(v0: f32):
v1 = sqrt v0
return v1
}
function %f32_ceil(f32) -> f32 {
ebb0(v0: f32):
v1 = ceil v0
return v1
}
function %f32_floor(f32) -> f32 {
ebb0(v0: f32):
v1 = floor v0
return v1
}
function %f32_trunc(f32) -> f32 {
ebb0(v0: f32):
v1 = trunc v0
return v1
}
function %f32_nearest (f32) -> f32 {
ebb0(v0: f32):
v1 = nearest v0
return v1
}
; Binary Operations
function %f32_add(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fadd v0, v1
return v2
}
function %f32_sub(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fsub v0, v1
return v2
}
function %f32_mul(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fmul v0, v1
return v2
}
function %f32_div(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fdiv v0, v1
return v2
}
function %f32_min(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fmin v0, v1
return v2
}
function %f32_max(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fmax v0, v1
return v2
}
function %f32_copysign(f32, f32) -> f32 {
ebb0(v0: f32, v1: f32):
v2 = fcopysign v0, v1
return v2
}

View File

@@ -0,0 +1,48 @@
; Test code generation for WebAssembly f32 comparison operators.
test compile
target i686 haswell
target x86_64 haswell
function %f32_eq(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_ne(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_lt(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp lt v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_gt(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp gt v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_le(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp le v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_ge(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp ge v0, v1
v3 = bint.i32 v2
return v3
}

View File

@@ -0,0 +1,26 @@
; Test basic code generation for f32 memory WebAssembly instructions.
test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target x86_64 haswell
function %f32_load(i32, i64 vmctx) -> f32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = load.f32 v2
return v3
}
function %f32_store(f32, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: f32, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
store v0, v3
return
}

View File

@@ -0,0 +1,101 @@
; Test basic code generation for f64 arithmetic WebAssembly instructions.
test compile
target x86_64 haswell
target x86_64 baseline
; Constants.
function %f64_const() -> f64 {
ebb0:
v1 = f64const 0x3.0
return v1
}
; Unary operations
function %f64_abs(f64) -> f64 {
ebb0(v0: f64):
v1 = fabs v0
return v1
}
function %f64_neg(f64) -> f64 {
ebb0(v0: f64):
v1 = fneg v0
return v1
}
function %f64_sqrt(f64) -> f64 {
ebb0(v0: f64):
v1 = sqrt v0
return v1
}
function %f64_ceil(f64) -> f64 {
ebb0(v0: f64):
v1 = ceil v0
return v1
}
function %f64_floor(f64) -> f64 {
ebb0(v0: f64):
v1 = floor v0
return v1
}
function %f64_trunc(f64) -> f64 {
ebb0(v0: f64):
v1 = trunc v0
return v1
}
function %f64_nearest (f64) -> f64 {
ebb0(v0: f64):
v1 = nearest v0
return v1
}
; Binary Operations
function %f64_add(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fadd v0, v1
return v2
}
function %f64_sub(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fsub v0, v1
return v2
}
function %f64_mul(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fmul v0, v1
return v2
}
function %f64_div(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fdiv v0, v1
return v2
}
function %f64_min(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fmin v0, v1
return v2
}
function %f64_max(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fmax v0, v1
return v2
}
function %f64_copysign(f64, f64) -> f64 {
ebb0(v0: f64, v1: f64):
v2 = fcopysign v0, v1
return v2
}

View File

@@ -0,0 +1,48 @@
; Test code generation for WebAssembly f64 comparison operators.
test compile
target i686 haswell
target x86_64 haswell
function %f64_eq(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_ne(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_lt(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp lt v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_gt(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp gt v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_le(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp le v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_ge(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp ge v0, v1
v3 = bint.i32 v2
return v3
}

View File

@@ -0,0 +1,26 @@
; Test basic code generation for f64 memory WebAssembly instructions.
test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target x86_64 haswell
function %f64_load(i32, i64 vmctx) -> f64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = load.f64 v2
return v3
}
function %f64_store(f64, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: f64, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
store v0, v3
return
}

View File

@@ -0,0 +1,127 @@
; Test basic code generation for i32 arithmetic WebAssembly instructions.
test compile
target i686 haswell
target i686 baseline
target x86_64 haswell
target x86_64 baseline
; Constants.
function %i32_const() -> i32 {
ebb0:
v0 = iconst.i32 0x8765_4321
return v0
}
; Unary operations.
function %i32_clz(i32) -> i32 {
ebb0(v0: i32):
v1 = clz v0
return v1
}
function %i32_ctz(i32) -> i32 {
ebb0(v0: i32):
v1 = ctz v0
return v1
}
function %i32_popcnt(i32) -> i32 {
ebb0(v0: i32):
v1 = popcnt v0
return v1
}
; Binary operations.
function %i32_add(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = iadd v0, v1
return v2
}
function %i32_sub(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = isub v0, v1
return v2
}
function %i32_mul(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = imul v0, v1
return v2
}
function %i32_div_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = sdiv v0, v1
return v2
}
function %i32_div_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = udiv v0, v1
return v2
}
function %i32_rem_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = srem v0, v1
return v2
}
function %i32_rem_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = urem v0, v1
return v2
}
function %i32_and(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = band v0, v1
return v2
}
function %i32_or(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = bor v0, v1
return v2
}
function %i32_xor(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = bxor v0, v1
return v2
}
function %i32_shl(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = ishl v0, v1
return v2
}
function %i32_shr_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = sshr v0, v1
return v2
}
function %i32_shr_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = ushr v0, v1
return v2
}
function %i32_rotl(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = rotl v0, v1
return v2
}
function %i32_rotr(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = rotr v0, v1
return v2
}

View File

@@ -0,0 +1,83 @@
; Test code generation for WebAssembly i32 comparison operators.
test compile
target i686 haswell
target x86_64 haswell
function %i32_eqz(i32) -> i32 {
ebb0(v0: i32):
v1 = icmp_imm eq v0, 0
v2 = bint.i32 v1
return v2
}
function %i32_eq(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_ne(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_lt_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp slt v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_lt_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp ult v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_gt_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp sgt v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_gt_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp ugt v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_le_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp sle v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_le_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp ule v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_ge_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp sge v0, v1
v3 = bint.i32 v2
return v3
}
function %i32_ge_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = icmp uge v0, v1
v3 = bint.i32 v2
return v3
}

View File

@@ -0,0 +1,87 @@
; Test basic code generation for i32 memory WebAssembly instructions.
test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target x86_64 haswell
function %i32_load(i32, i64 vmctx) -> i32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = load.i32 v2
return v3
}
function %i32_store(i32, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
store v0, v3
return
}
function %i32_load8_s(i32, i64 vmctx) -> i32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = sload8.i32 v2
return v3
}
function %i32_load8_u(i32, i64 vmctx) -> i32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = uload8.i32 v2
return v3
}
function %i32_store8(i32, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
istore8 v0, v3
return
}
function %i32_load16_s(i32, i64 vmctx) -> i32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = sload16.i32 v2
return v3
}
function %i32_load16_u(i32, i64 vmctx) -> i32 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = uload16.i32 v2
return v3
}
function %i32_store16(i32, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
istore16 v0, v3
return
}

View File

@@ -0,0 +1,125 @@
; Test basic code generation for i64 arithmetic WebAssembly instructions.
test compile
target x86_64 haswell
target x86_64 baseline
; Constants.
function %i64_const() -> i64 {
ebb0:
v0 = iconst.i64 0x8765_4321
return v0
}
; Unary operations.
function %i64_clz(i64) -> i64 {
ebb0(v0: i64):
v1 = clz v0
return v1
}
function %i64_ctz(i64) -> i64 {
ebb0(v0: i64):
v1 = ctz v0
return v1
}
function %i64_popcnt(i64) -> i64 {
ebb0(v0: i64):
v1 = popcnt v0
return v1
}
; Binary operations.
function %i64_add(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = iadd v0, v1
return v2
}
function %i64_sub(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = isub v0, v1
return v2
}
function %i64_mul(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = imul v0, v1
return v2
}
function %i32_div_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = sdiv v0, v1
return v2
}
function %i32_div_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = udiv v0, v1
return v2
}
function %i32_rem_s(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = srem v0, v1
return v2
}
function %i32_rem_u(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = urem v0, v1
return v2
}
function %i64_and(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = band v0, v1
return v2
}
function %i64_or(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = bor v0, v1
return v2
}
function %i64_xor(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = bxor v0, v1
return v2
}
function %i64_shl(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = ishl v0, v1
return v2
}
function %i64_shr_s(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = sshr v0, v1
return v2
}
function %i64_shr_u(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = ushr v0, v1
return v2
}
function %i64_rotl(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = rotl v0, v1
return v2
}
function %i64_rotr(i64, i64) -> i64 {
ebb0(v0: i64, v1: i64):
v2 = rotr v0, v1
return v2
}

View File

@@ -0,0 +1,81 @@
; Test code generation for WebAssembly i64 comparison operators.
test compile
target x86_64 haswell
function %i64_eqz(i64) -> i32 {
ebb0(v0: i64):
v1 = icmp_imm eq v0, 0
v2 = bint.i32 v1
return v2
}
function %i64_eq(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_ne(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_lt_s(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp slt v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_lt_u(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp ult v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_gt_s(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp sgt v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_gt_u(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp ugt v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_le_s(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp sle v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_le_u(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp ule v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_ge_s(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp sge v0, v1
v3 = bint.i32 v2
return v3
}
function %i64_ge_u(i64, i64) -> i32 {
ebb0(v0: i64, v1: i64):
v2 = icmp uge v0, v1
v3 = bint.i32 v2
return v3
}

View File

@@ -0,0 +1,116 @@
; Test basic code generation for i32 memory WebAssembly instructions.
test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target x86_64 haswell
function %i64_load(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = load.i64 v2
return v3
}
function %i64_store(i64, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i64, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
store v0, v3
return
}
function %i64_load8_s(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = sload8.i64 v2
return v3
}
function %i64_load8_u(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = uload8.i64 v2
return v3
}
function %i64_store8(i64, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i64, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
istore8 v0, v3
return
}
function %i64_load16_s(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = sload16.i64 v2
return v3
}
function %i64_load16_u(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = uload16.i64 v2
return v3
}
function %i64_store16(i64, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i64, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
istore16 v0, v3
return
}
function %i64_load32_s(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = sload32.i64 v2
return v3
}
function %i64_load32_u(i32, i64 vmctx) -> i64 {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = uload32.i64 v2
return v3
}
function %i64_store32(i64, i32, i64 vmctx) {
gv0 = vmctx
heap0 = static gv0, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
ebb0(v0: i64, v1: i32, v2: i64):
v3 = heap_addr.i64 heap0, v1, 1
istore32 v0, v3
return
}

View File

@@ -0,0 +1,30 @@
; Test basic code generation for the select WebAssembly instruction.
test compile
target i686 haswell
target x86_64 haswell
function %select_i32(i32, i32, i32) -> i32 {
ebb0(v0: i32, v1: i32, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_i64(i64, i64, i32) -> i64 {
ebb0(v0: i64, v1: i64, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_f32(f32, f32, i32) -> f32 {
ebb0(v0: f32, v1: f32, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_f64(f64, f64, i32) -> f64 {
ebb0(v0: f64, v1: f64, v2: i32):
v3 = select v2, v0, v1
return v3
}