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:
32
cranelift/filetests/filetests/parser/alias.clif
Normal file
32
cranelift/filetests/filetests/parser/alias.clif
Normal file
@@ -0,0 +1,32 @@
|
||||
test cat
|
||||
test verifier
|
||||
|
||||
function %basic(i32, i32) -> i32 {
|
||||
ebb0(v0: i32, v1: i32):
|
||||
v2 -> v0
|
||||
v3 -> v1
|
||||
v4 = iadd.i32 v2, v3
|
||||
return v4
|
||||
}
|
||||
|
||||
function %transitive() -> i32 {
|
||||
ebb0:
|
||||
v0 = iconst.i32 0
|
||||
v1 -> v0
|
||||
v2 -> v1
|
||||
v3 -> v2
|
||||
v4 -> v3
|
||||
return v4
|
||||
}
|
||||
|
||||
function %duplicate(i32, i32) -> i32 {
|
||||
ebb0(v0: i32, v1: i32):
|
||||
v2 -> v0
|
||||
v2 -> v0
|
||||
v2 -> v0
|
||||
v3 -> v1
|
||||
v3 -> v1
|
||||
v3 -> v1
|
||||
v4 = iadd.i32 v2, v3
|
||||
return v4
|
||||
}
|
||||
116
cranelift/filetests/filetests/parser/branch.clif
Normal file
116
cranelift/filetests/filetests/parser/branch.clif
Normal file
@@ -0,0 +1,116 @@
|
||||
; Parsing branches and jumps.
|
||||
test cat
|
||||
|
||||
; Jumps with no arguments. The '()' empty argument list is optional.
|
||||
function %minimal() {
|
||||
ebb0:
|
||||
jump ebb1
|
||||
|
||||
ebb1:
|
||||
jump ebb0()
|
||||
}
|
||||
; sameln: function %minimal() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: jump ebb1
|
||||
; nextln:
|
||||
; nextln: ebb1:
|
||||
; nextln: jump ebb0
|
||||
; nextln: }
|
||||
|
||||
; Jumps with 1 arg.
|
||||
function %onearg(i32) {
|
||||
ebb0(v90: i32):
|
||||
jump ebb1(v90)
|
||||
|
||||
ebb1(v91: i32):
|
||||
jump ebb0(v91)
|
||||
}
|
||||
; sameln: function %onearg(i32) fast {
|
||||
; nextln: ebb0(v90: i32):
|
||||
; nextln: jump ebb1(v90)
|
||||
; nextln:
|
||||
; nextln: ebb1(v91: i32):
|
||||
; nextln: jump ebb0(v91)
|
||||
; nextln: }
|
||||
|
||||
; Jumps with 2 args.
|
||||
function %twoargs(i32, f32) {
|
||||
ebb0(v90: i32, v91: f32):
|
||||
jump ebb1(v90, v91)
|
||||
|
||||
ebb1(v92: i32, v93: f32):
|
||||
jump ebb0(v92, v93)
|
||||
}
|
||||
; sameln: function %twoargs(i32, f32) fast {
|
||||
; nextln: ebb0(v90: i32, v91: f32):
|
||||
; nextln: jump ebb1(v90, v91)
|
||||
; nextln:
|
||||
; nextln: ebb1(v92: i32, v93: f32):
|
||||
; nextln: jump ebb0(v92, v93)
|
||||
; nextln: }
|
||||
|
||||
; Branches with no arguments. The '()' empty argument list is optional.
|
||||
function %minimal(i32) {
|
||||
ebb0(v90: i32):
|
||||
brz v90, ebb1
|
||||
|
||||
ebb1:
|
||||
brnz v90, ebb1()
|
||||
}
|
||||
; sameln: function %minimal(i32) fast {
|
||||
; nextln: ebb0(v90: i32):
|
||||
; nextln: brz v90, ebb1
|
||||
; nextln:
|
||||
; nextln: ebb1:
|
||||
; nextln: brnz.i32 v90, ebb1
|
||||
; nextln: }
|
||||
|
||||
function %twoargs(i32, f32) {
|
||||
ebb0(v90: i32, v91: f32):
|
||||
brz v90, ebb1(v90, v91)
|
||||
|
||||
ebb1(v92: i32, v93: f32):
|
||||
brnz v90, ebb0(v92, v93)
|
||||
}
|
||||
; sameln: function %twoargs(i32, f32) fast {
|
||||
; nextln: ebb0(v90: i32, v91: f32):
|
||||
; nextln: brz v90, ebb1(v90, v91)
|
||||
; nextln:
|
||||
; nextln: ebb1(v92: i32, v93: f32):
|
||||
; nextln: brnz.i32 v90, ebb0(v92, v93)
|
||||
; nextln: }
|
||||
|
||||
function %jumptable(i32) {
|
||||
jt200 = jump_table []
|
||||
jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
|
||||
|
||||
ebb10(v3: i32):
|
||||
br_table v3, ebb50, jt2
|
||||
|
||||
ebb20:
|
||||
trap user2
|
||||
ebb30:
|
||||
trap user3
|
||||
ebb40:
|
||||
trap user4
|
||||
ebb50:
|
||||
trap user1
|
||||
}
|
||||
; sameln: function %jumptable(i32) fast {
|
||||
; check: jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
|
||||
; check: jt200 = jump_table []
|
||||
; check: ebb10(v3: i32):
|
||||
; nextln: br_table v3, ebb50, jt2
|
||||
; nextln:
|
||||
; nextln: ebb20:
|
||||
; nextln: trap user2
|
||||
; nextln:
|
||||
; nextln: ebb30:
|
||||
; nextln: trap user3
|
||||
; nextln:
|
||||
; nextln: ebb40:
|
||||
; nextln: trap user4
|
||||
; nextln:
|
||||
; nextln: ebb50:
|
||||
; nextln: trap user1
|
||||
; nextln: }
|
||||
94
cranelift/filetests/filetests/parser/call.clif
Normal file
94
cranelift/filetests/filetests/parser/call.clif
Normal file
@@ -0,0 +1,94 @@
|
||||
; Parser tests for call and return syntax.
|
||||
test cat
|
||||
|
||||
function %mini() {
|
||||
ebb1:
|
||||
return
|
||||
}
|
||||
; sameln: function %mini() fast {
|
||||
; nextln: ebb1:
|
||||
; nextln: return
|
||||
; nextln: }
|
||||
|
||||
function %r1() -> i32, f32 baldrdash {
|
||||
ebb1:
|
||||
v1 = iconst.i32 3
|
||||
v2 = f32const 0.0
|
||||
return v1, v2
|
||||
}
|
||||
; sameln: function %r1() -> i32, f32 baldrdash {
|
||||
; nextln: ebb1:
|
||||
; nextln: v1 = iconst.i32 3
|
||||
; nextln: v2 = f32const 0.0
|
||||
; nextln: return v1, v2
|
||||
; nextln: }
|
||||
|
||||
function %signatures() {
|
||||
sig10 = ()
|
||||
sig11 = (i32, f64) -> i32, b1 baldrdash
|
||||
fn5 = %foo sig11
|
||||
fn8 = %bar(i32) -> b1
|
||||
}
|
||||
; sameln: function %signatures() fast {
|
||||
; check: sig10 = () fast
|
||||
; check: sig11 = (i32, f64) -> i32, b1 baldrdash
|
||||
; check: sig12 = (i32) -> b1 fast
|
||||
; not: fn0
|
||||
; check: fn5 = %foo sig11
|
||||
; check: fn8 = %bar sig12
|
||||
; check: }
|
||||
|
||||
function %direct() {
|
||||
fn0 = %none()
|
||||
fn1 = %one() -> i32
|
||||
fn2 = %two() -> i32, f32
|
||||
|
||||
ebb0:
|
||||
call fn0()
|
||||
v1 = call fn1()
|
||||
v2, v3 = call fn2()
|
||||
return
|
||||
}
|
||||
; check: call fn0()
|
||||
; check: v1 = call fn1()
|
||||
; check: v2, v3 = call fn2()
|
||||
; check: return
|
||||
|
||||
function %indirect(i64) {
|
||||
sig0 = (i64)
|
||||
sig1 = () -> i32
|
||||
sig2 = () -> i32, f32
|
||||
|
||||
ebb0(v0: i64):
|
||||
v1 = call_indirect sig1, v0()
|
||||
call_indirect sig0, v1(v0)
|
||||
v3, v4 = call_indirect sig2, v1()
|
||||
return
|
||||
}
|
||||
; check: v1 = call_indirect sig1, v0()
|
||||
; check: call_indirect sig0, v1(v0)
|
||||
; check: v3, v4 = call_indirect sig2, v1()
|
||||
; check: return
|
||||
|
||||
function %long_call() {
|
||||
sig0 = ()
|
||||
fn0 = %none sig0
|
||||
|
||||
ebb0:
|
||||
v0 = func_addr.i32 fn0
|
||||
call_indirect sig0, v0()
|
||||
return
|
||||
}
|
||||
; check: v0 = func_addr.i32 fn0
|
||||
; check: call_indirect sig0, v0()
|
||||
; check: return
|
||||
|
||||
; Special purpose function arguments
|
||||
function %special1(i32 sret, i32 fp, i32 csr, i32 link) -> i32 link, i32 fp, i32 csr, i32 sret {
|
||||
ebb0(v1: i32, v2: i32, v3: i32, v4: i32):
|
||||
return v4, v2, v3, v1
|
||||
}
|
||||
; check: function %special1(i32 sret, i32 fp, i32 csr, i32 link) -> i32 link, i32 fp, i32 csr, i32 sret fast {
|
||||
; check: ebb0(v1: i32, v2: i32, v3: i32, v4: i32):
|
||||
; check: return v4, v2, v3, v1
|
||||
; check: }
|
||||
46
cranelift/filetests/filetests/parser/flags.clif
Normal file
46
cranelift/filetests/filetests/parser/flags.clif
Normal file
@@ -0,0 +1,46 @@
|
||||
test cat
|
||||
test verifier
|
||||
|
||||
function %iflags(i32) {
|
||||
ebb200(v0: i32):
|
||||
v1 = ifcmp_imm v0, 17
|
||||
brif eq v1, ebb201
|
||||
brif ugt v1, ebb202
|
||||
v2 = iconst.i32 34
|
||||
v3 = ifcmp v0, v2
|
||||
v4 = trueif eq v3
|
||||
brnz v4, ebb202
|
||||
return
|
||||
|
||||
ebb201:
|
||||
return
|
||||
|
||||
ebb202:
|
||||
trap oob
|
||||
}
|
||||
; check: v1 = ifcmp_imm v0, 17
|
||||
; check: brif eq v1, ebb201
|
||||
; check: brif ugt v1, ebb202
|
||||
; check: v3 = ifcmp v0, v2
|
||||
; check: v4 = trueif eq v3
|
||||
|
||||
function %fflags(f32) {
|
||||
ebb200(v0: f32):
|
||||
v1 = f32const 0x34.0p0
|
||||
v2 = ffcmp v0, v1
|
||||
brff eq v2, ebb201
|
||||
brff ord v2, ebb202
|
||||
v3 = trueff gt v2
|
||||
brnz v3, ebb202
|
||||
return
|
||||
|
||||
ebb201:
|
||||
return
|
||||
|
||||
ebb202:
|
||||
trap oob
|
||||
}
|
||||
; check: v2 = ffcmp v0, v1
|
||||
; check: brff eq v2, ebb201
|
||||
; check: brff ord v2, ebb202
|
||||
; check: v3 = trueff gt v2
|
||||
@@ -0,0 +1,24 @@
|
||||
test cat
|
||||
|
||||
target riscv32
|
||||
|
||||
; regex: WS=[ \t]*
|
||||
|
||||
function %foo(i32, i32) {
|
||||
ebb1(v0: i32 [%x8], v1: i32):
|
||||
[-,-] v2 = iadd v0, v1
|
||||
[-] trap heap_oob
|
||||
[R#1234, %x5, %x11] v6, v7 = iadd_cout v2, v0
|
||||
[Rshamt#beef, %x25] v8 = ishl_imm v6, 2
|
||||
@55 v9 = iadd v8, v7
|
||||
@a5 [Iret#5] return v0, v8
|
||||
}
|
||||
; sameln: function %foo(i32, i32) fast {
|
||||
; nextln: ebb1(v0: i32 [%x8], v1: i32):
|
||||
; nextln: [-,-]$WS v2 = iadd v0, v1
|
||||
; nextln: [-]$WS trap heap_oob
|
||||
; nextln: [R#1234,%x5,%x11]$WS v6, v7 = iadd_cout v2, v0
|
||||
; nextln: [Rshamt#beef,%x25]$WS v8 = ishl_imm v6, 2
|
||||
; nextln: @0055 [-,-]$WS v9 = iadd v8, v7
|
||||
; nextln: @00a5 [Iret#05]$WS return v0, v8
|
||||
; nextln: }
|
||||
5
cranelift/filetests/filetests/parser/keywords.clif
Normal file
5
cranelift/filetests/filetests/parser/keywords.clif
Normal file
@@ -0,0 +1,5 @@
|
||||
test cat
|
||||
|
||||
; 'function' is not a keyword, and can be used as the name of a function too.
|
||||
function %function() {}
|
||||
; check: function %function() fast
|
||||
82
cranelift/filetests/filetests/parser/memory.clif
Normal file
82
cranelift/filetests/filetests/parser/memory.clif
Normal file
@@ -0,0 +1,82 @@
|
||||
test cat
|
||||
test verifier
|
||||
|
||||
function %vmglobal(i64 vmctx) -> i32 {
|
||||
gv3 = vmctx
|
||||
; check: gv3 = vmctx
|
||||
ebb0(v0: i64):
|
||||
v1 = global_value.i32 gv3
|
||||
; check: v1 = global_value.i32 gv3
|
||||
return v1
|
||||
}
|
||||
|
||||
function %load_and_add_imm(i64 vmctx) -> i32 {
|
||||
gv2 = vmctx
|
||||
gv3 = load.i32 notrap aligned gv2-72
|
||||
gv4 = iadd_imm.i32 gv3, -32
|
||||
; check: gv2 = vmctx
|
||||
; check: gv3 = load.i32 notrap aligned gv2-72
|
||||
; check: gv4 = iadd_imm.i32 gv3, -32
|
||||
ebb0(v0: i64):
|
||||
v1 = global_value.i32 gv4
|
||||
; check: v1 = global_value.i32 gv4
|
||||
return v1
|
||||
}
|
||||
|
||||
; Refer to a global value before it's been declared.
|
||||
function %backref(i64 vmctx) -> i32 {
|
||||
gv0 = iadd_imm.i32 gv1, -32
|
||||
; check: gv0 = iadd_imm.i32 gv1, -32
|
||||
gv1 = load.i32 notrap aligned gv2
|
||||
; check: gv1 = load.i32 notrap aligned gv2
|
||||
gv2 = vmctx
|
||||
; check: gv2 = vmctx
|
||||
ebb0(v0: i64):
|
||||
v1 = global_value.i32 gv1
|
||||
return v1
|
||||
}
|
||||
|
||||
function %symbol() -> i32 {
|
||||
gv0 = symbol %something
|
||||
; check: gv0 = symbol %something
|
||||
gv1 = symbol u8:9
|
||||
; check: gv1 = symbol u8:9
|
||||
ebb0:
|
||||
v0 = global_value.i32 gv0
|
||||
; check: v0 = global_value.i32 gv0
|
||||
v1 = global_value.i32 gv1
|
||||
; check: v1 = global_value.i32 gv1
|
||||
v2 = bxor v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
; Declare static heaps.
|
||||
function %sheap(i32, i64 vmctx) -> i64 {
|
||||
heap1 = static gv5, min 0x1_0000, bound 0x1_0000_0000, offset_guard 0x8000_0000
|
||||
heap2 = static gv5, offset_guard 0x1000, bound 0x1_0000
|
||||
gv4 = vmctx
|
||||
gv5 = iadd_imm.i64 gv4, 64
|
||||
|
||||
; check: heap1 = static gv5, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
|
||||
; check: heap2 = static gv5, min 0, bound 0x0001_0000, offset_guard 4096
|
||||
ebb0(v1: i32, v2: i64):
|
||||
v3 = heap_addr.i64 heap1, v1, 0
|
||||
; check: v3 = heap_addr.i64 heap1, v1, 0
|
||||
return v3
|
||||
}
|
||||
|
||||
; Declare dynamic heaps.
|
||||
function %dheap(i32, i64 vmctx) -> i64 {
|
||||
heap1 = dynamic gv5, min 0x1_0000, bound gv6, offset_guard 0x8000_0000
|
||||
heap2 = dynamic gv5, bound gv6, offset_guard 0x1000
|
||||
gv4 = vmctx
|
||||
gv5 = iadd_imm.i64 gv4, 64
|
||||
gv6 = iadd_imm.i64 gv4, 72
|
||||
|
||||
; check: heap1 = dynamic gv5, min 0x0001_0000, bound gv6, offset_guard 0x8000_0000
|
||||
; check: heap2 = dynamic gv5, min 0, bound gv6, offset_guard 4096
|
||||
ebb0(v1: i32, v2: i64):
|
||||
v3 = heap_addr.i64 heap2, v1, 0
|
||||
; check: v3 = heap_addr.i64 heap2, v1, 0
|
||||
return v3
|
||||
}
|
||||
31
cranelift/filetests/filetests/parser/rewrite.clif
Normal file
31
cranelift/filetests/filetests/parser/rewrite.clif
Normal file
@@ -0,0 +1,31 @@
|
||||
; It is possible to refer to instructions and EBBs that have not yet been
|
||||
; defined in the lexical order.
|
||||
test cat
|
||||
|
||||
; Defining numbers.
|
||||
function %defs() {
|
||||
ebb100(v20: i32):
|
||||
v1000 = iconst.i32x8 5
|
||||
v9200 = f64const 0x4.0p0
|
||||
trap user4
|
||||
}
|
||||
; sameln: function %defs() fast {
|
||||
; nextln: ebb100(v20: i32):
|
||||
; nextln: v1000 = iconst.i32x8 5
|
||||
; nextln: v9200 = f64const 0x1.0000000000000p2
|
||||
; nextln: trap user4
|
||||
; nextln: }
|
||||
|
||||
; Using values.
|
||||
function %use_value() {
|
||||
ebb100(v20: i32):
|
||||
v1000 = iadd_imm v20, 5
|
||||
v200 = iadd v20, v1000
|
||||
jump ebb100(v1000)
|
||||
}
|
||||
; sameln: function %use_value() fast {
|
||||
; nextln: ebb100(v20: i32):
|
||||
; nextln: v1000 = iadd_imm v20, 5
|
||||
; nextln: v200 = iadd v20, v1000
|
||||
; nextln: jump ebb100(v1000)
|
||||
; nextln: }
|
||||
24
cranelift/filetests/filetests/parser/ternary.clif
Normal file
24
cranelift/filetests/filetests/parser/ternary.clif
Normal file
@@ -0,0 +1,24 @@
|
||||
test cat
|
||||
test verifier
|
||||
|
||||
function %add_i96(i32, i32, i32, i32, i32, i32) -> i32, i32, i32 {
|
||||
ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
|
||||
v10, v11 = iadd_cout v1, v4
|
||||
;check: v10, v11 = iadd_cout v1, v4
|
||||
v20, v21 = iadd_carry v2, v5, v11
|
||||
; check: v20, v21 = iadd_carry v2, v5, v11
|
||||
v30 = iadd_cin v3, v6, v21
|
||||
; check: v30 = iadd_cin v3, v6, v21
|
||||
return v10, v20, v30
|
||||
}
|
||||
|
||||
function %sub_i96(i32, i32, i32, i32, i32, i32) -> i32, i32, i32 {
|
||||
ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
|
||||
v10, v11 = isub_bout v1, v4
|
||||
;check: v10, v11 = isub_bout v1, v4
|
||||
v20, v21 = isub_borrow v2, v5, v11
|
||||
; check: v20, v21 = isub_borrow v2, v5, v11
|
||||
v30 = isub_bin v3, v6, v21
|
||||
; check: v30 = isub_bin v3, v6, v21
|
||||
return v10, v20, v30
|
||||
}
|
||||
241
cranelift/filetests/filetests/parser/tiny.clif
Normal file
241
cranelift/filetests/filetests/parser/tiny.clif
Normal file
@@ -0,0 +1,241 @@
|
||||
test cat
|
||||
|
||||
; The smallest possible function.
|
||||
function %minimal() {
|
||||
ebb0:
|
||||
trap user0
|
||||
}
|
||||
; sameln: function %minimal() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: trap user0
|
||||
; nextln: }
|
||||
|
||||
; Create and use values.
|
||||
; Polymorphic instructions with type suffix.
|
||||
function %ivalues() {
|
||||
ebb0:
|
||||
v0 = iconst.i32 2
|
||||
v1 = iconst.i8 6
|
||||
v2 = ishl v0, v1
|
||||
}
|
||||
; sameln: function %ivalues() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: v0 = iconst.i32 2
|
||||
; nextln: v1 = iconst.i8 6
|
||||
; nextln: v2 = ishl v0, v1
|
||||
; nextln: }
|
||||
|
||||
; Create and use values.
|
||||
; Polymorphic instructions with type suffix.
|
||||
function %bvalues() {
|
||||
ebb0:
|
||||
v0 = bconst.b32 true
|
||||
v1 = bconst.b8 false
|
||||
v2 = bextend.b32 v1
|
||||
v3 = bxor v0, v2
|
||||
}
|
||||
; sameln: function %bvalues() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: v0 = bconst.b32 true
|
||||
; nextln: v1 = bconst.b8 false
|
||||
; nextln: v2 = bextend.b32 v1
|
||||
; nextln: v3 = bxor v0, v2
|
||||
; nextln: }
|
||||
|
||||
; Polymorphic instruction controlled by second operand.
|
||||
function %select() {
|
||||
ebb0(v90: i32, v91: i32, v92: b1):
|
||||
v0 = select v92, v90, v91
|
||||
}
|
||||
; sameln: function %select() fast {
|
||||
; nextln: ebb0(v90: i32, v91: i32, v92: b1):
|
||||
; nextln: v0 = select v92, v90, v91
|
||||
; nextln: }
|
||||
|
||||
; Polymorphic instruction controlled by third operand.
|
||||
function %selectif() system_v {
|
||||
ebb0(v95: i32, v96: i32, v97: b1):
|
||||
v98 = selectif.i32 eq v97, v95, v96
|
||||
}
|
||||
; sameln: function %selectif() system_v {
|
||||
; nextln: ebb0(v95: i32, v96: i32, v97: b1):
|
||||
; nextln: v98 = selectif.i32 eq v97, v95, v96
|
||||
; nextln: }
|
||||
|
||||
; Lane indexes.
|
||||
function %lanes() {
|
||||
ebb0:
|
||||
v0 = iconst.i32x4 2
|
||||
v1 = extractlane v0, 3
|
||||
v2 = insertlane v0, 1, v1
|
||||
}
|
||||
; sameln: function %lanes() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: v0 = iconst.i32x4 2
|
||||
; nextln: v1 = extractlane v0, 3
|
||||
; nextln: v2 = insertlane v0, 1, v1
|
||||
; nextln: }
|
||||
|
||||
; Integer condition codes.
|
||||
function %icmp(i32, i32) {
|
||||
ebb0(v90: i32, v91: i32):
|
||||
v0 = icmp eq v90, v91
|
||||
v1 = icmp ult v90, v91
|
||||
v2 = icmp_imm sge v90, -12
|
||||
v3 = irsub_imm v91, 45
|
||||
br_icmp eq v90, v91, ebb0(v91, v90)
|
||||
}
|
||||
; sameln: function %icmp(i32, i32) fast {
|
||||
; nextln: ebb0(v90: i32, v91: i32):
|
||||
; nextln: v0 = icmp eq v90, v91
|
||||
; nextln: v1 = icmp ult v90, v91
|
||||
; nextln: v2 = icmp_imm sge v90, -12
|
||||
; nextln: v3 = irsub_imm v91, 45
|
||||
; nextln: br_icmp eq v90, v91, ebb0(v91, v90)
|
||||
; nextln: }
|
||||
|
||||
; Floating condition codes.
|
||||
function %fcmp(f32, f32) {
|
||||
ebb0(v90: f32, v91: f32):
|
||||
v0 = fcmp eq v90, v91
|
||||
v1 = fcmp uno v90, v91
|
||||
v2 = fcmp lt v90, v91
|
||||
}
|
||||
; sameln: function %fcmp(f32, f32) fast {
|
||||
; nextln: ebb0(v90: f32, v91: f32):
|
||||
; nextln: v0 = fcmp eq v90, v91
|
||||
; nextln: v1 = fcmp uno v90, v91
|
||||
; nextln: v2 = fcmp lt v90, v91
|
||||
; nextln: }
|
||||
|
||||
; The bitcast instruction has two type variables: The controlling type variable
|
||||
; controls the outout type, and the input type is a free variable.
|
||||
function %bitcast(i32, f32) {
|
||||
ebb0(v90: i32, v91: f32):
|
||||
v0 = bitcast.i8x4 v90
|
||||
v1 = bitcast.i32 v91
|
||||
}
|
||||
; sameln: function %bitcast(i32, f32) fast {
|
||||
; nextln: ebb0(v90: i32, v91: f32):
|
||||
; nextln: v0 = bitcast.i8x4 v90
|
||||
; nextln: v1 = bitcast.i32 v91
|
||||
; nextln: }
|
||||
|
||||
; Stack slot references
|
||||
function %stack() {
|
||||
ss10 = spill_slot 8
|
||||
ss2 = explicit_slot 4
|
||||
ss3 = incoming_arg 4, offset 8
|
||||
ss4 = outgoing_arg 4
|
||||
ss5 = emergency_slot 4
|
||||
|
||||
ebb0:
|
||||
v1 = stack_load.i32 ss10
|
||||
v2 = stack_load.i32 ss10+4
|
||||
stack_store v1, ss10+2
|
||||
stack_store v2, ss2
|
||||
}
|
||||
; sameln: function %stack() fast {
|
||||
; check: ss2 = explicit_slot 4
|
||||
; check: ss3 = incoming_arg 4, offset 8
|
||||
; check: ss4 = outgoing_arg 4
|
||||
; check: ss5 = emergency_slot 4
|
||||
; check: ss10 = spill_slot 8
|
||||
|
||||
; check: ebb0:
|
||||
; nextln: v1 = stack_load.i32 ss10
|
||||
; nextln: v2 = stack_load.i32 ss10+4
|
||||
; nextln: stack_store v1, ss10+2
|
||||
; nextln: stack_store v2, ss2
|
||||
|
||||
; Memory access instructions.
|
||||
function %memory(i32) {
|
||||
ebb0(v1: i32):
|
||||
v2 = load.i64 v1
|
||||
v3 = load.i64 aligned v1
|
||||
v4 = load.i64 notrap v1
|
||||
v5 = load.i64 notrap aligned v1
|
||||
v6 = load.i64 aligned notrap v1
|
||||
v7 = load.i64 v1-12
|
||||
v8 = load.i64 notrap v1+0x1_0000
|
||||
v9 = load_complex.i64 v1+v2
|
||||
v10 = load_complex.i64 v1+v2+0x1
|
||||
store v2, v1
|
||||
store aligned v3, v1+12
|
||||
store notrap aligned v3, v1-12
|
||||
store_complex v3, v1+v2
|
||||
store_complex v3, v1+v2+0x1
|
||||
}
|
||||
; sameln: function %memory(i32) fast {
|
||||
; nextln: ebb0(v1: i32):
|
||||
; nextln: v2 = load.i64 v1
|
||||
; nextln: v3 = load.i64 aligned v1
|
||||
; nextln: v4 = load.i64 notrap v1
|
||||
; nextln: v5 = load.i64 notrap aligned v1
|
||||
; nextln: v6 = load.i64 notrap aligned v1
|
||||
; nextln: v7 = load.i64 v1-12
|
||||
; nextln: v8 = load.i64 notrap v1+0x0001_0000
|
||||
; nextln: v9 = load_complex.i64 v1+v2
|
||||
; nextln: v10 = load_complex.i64 v1+v2+1
|
||||
; nextln: store v2, v1
|
||||
; nextln: store aligned v3, v1+12
|
||||
; nextln: store notrap aligned v3, v1-12
|
||||
; nextln: store_complex v3, v1+v2
|
||||
; nextln: store_complex v3, v1+v2+1
|
||||
|
||||
; Register diversions.
|
||||
; This test file has no ISA, so we can unly use register unit numbers.
|
||||
function %diversion(i32) {
|
||||
ss0 = spill_slot 4
|
||||
|
||||
ebb0(v1: i32):
|
||||
regmove v1, %10 -> %20
|
||||
regmove v1, %20 -> %10
|
||||
regspill v1, %10 -> ss0
|
||||
regfill v1, ss0 -> %10
|
||||
return
|
||||
}
|
||||
; sameln: function %diversion(i32) fast {
|
||||
; nextln: ss0 = spill_slot 4
|
||||
; check: ebb0(v1: i32):
|
||||
; nextln: regmove v1, %10 -> %20
|
||||
; nextln: regmove v1, %20 -> %10
|
||||
; nextln: regspill v1, %10 -> ss0
|
||||
; nextln: regfill v1, ss0 -> %10
|
||||
; nextln: return
|
||||
; nextln: }
|
||||
|
||||
; Register copies.
|
||||
function %copy_special() {
|
||||
ebb0:
|
||||
copy_special %10 -> %20
|
||||
copy_special %20 -> %10
|
||||
return
|
||||
}
|
||||
; sameln: function %copy_special() fast {
|
||||
; nextln: ebb0:
|
||||
; nextln: copy_special %10 -> %20
|
||||
; nextln: copy_special %20 -> %10
|
||||
; nextln: return
|
||||
; nextln: }
|
||||
|
||||
function %cond_traps(i32) {
|
||||
ebb0(v0: i32):
|
||||
trapz v0, stk_ovf
|
||||
v1 = ifcmp_imm v0, 5
|
||||
trapif ugt v1, oob
|
||||
v2 = bitcast.f32 v1
|
||||
v3 = ffcmp v2, v2
|
||||
trapff uno v3, int_ovf
|
||||
return
|
||||
}
|
||||
; sameln: function %cond_traps(i32)
|
||||
; nextln: ebb0(v0: i32):
|
||||
; nextln: trapz v0, stk_ovf
|
||||
; nextln: v1 = ifcmp_imm v0, 5
|
||||
; nextln: trapif ugt v1, oob
|
||||
; nextln: v2 = bitcast.f32 v1
|
||||
; nextln: v3 = ffcmp v2, v2
|
||||
; nextln: trapff uno v3, int_ovf
|
||||
; nextln: return
|
||||
; nextln: }
|
||||
Reference in New Issue
Block a user