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.
128 lines
2.0 KiB
Plaintext
128 lines
2.0 KiB
Plaintext
; 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
|
|
}
|