Files
wasmtime/cranelift/filetests/isa/x86/legalize-table.clif
Dan Gohman 8e2d01a675 Add an index_type field to Table.
This parallels the `index_type` field in `Heap`.
2018-08-28 14:28:43 -07:00

28 lines
733 B
Plaintext

; Test legalization of tables
test legalizer
target x86_64
; regex: V=v\d+
; regex: EBB=ebb\d+
function %test0(i64 vmctx, i64) -> i64 {
gv0 = vmctx+12
gv1 = vmctx+14
table0 = dynamic gv0, min 20, bound gv1, element_size 4, index_type i64
ebb0(v0: i64, v1: i64):
v2 = table_addr.i64 table0, v1, +3
return v2
}
; check: $(bound=$V) = iadd_imm $(input=$V), 14
; nextln: $(cond=$V) = icmp uge $(limit=$V), $bound
; nextln: brz $cond, ebb1
; nextln: trap table_oob
; nextln:
; nextln: ebb1:
; nextln: $(base=$V) = iadd_imm.i64 $(vmctx=$V), 12
; nextln: $(scaled=$V) = ishl_imm.i64 $(index=$V), 2
; nextln: $(elem_addr=$V) = iadd $base, $scaled
; nextln: $(field_addr=$V) = iadd_imm $elem_addr, 3