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.
64 lines
870 B
Plaintext
64 lines
870 B
Plaintext
; 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, 0, ebb2
|
|
|
|
ebb0(v0: i32):
|
|
br_table v0, jt0
|
|
trap oob
|
|
|
|
ebb1:
|
|
return
|
|
ebb2:
|
|
return
|
|
ebb3:
|
|
return
|
|
}
|