Files
wasmtime/cranelift/filetests/wasm/i64-arith.cton
Dan Gohman 4e67e08efd Use the target-lexicon crate.
This switches from a custom list of architectures to use the
target-lexicon crate.

 - "set is_64bit=1; isa x86" is replaced with "target x86_64", and
   similar for other architectures, and the `is_64bit` flag is removed
   entirely.

 - The `is_compressed` flag is removed too; it's no longer being used to
   control REX prefixes on x86-64, ARM and Thumb are separate
   architectures in target-lexicon, and we can figure out how to
   select RISC-V compressed encodings when we're ready.
2018-05-30 06:13:35 -07:00

126 lines
2.0 KiB
Plaintext

; 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
}