Simplify jump table instructions and add missing conversion;

This makes non-legalized jump table instructions operate on operands with
pointer-sized types. This means we need to extend smaller types into the
pointer-sized operand, when the two don't match.
This commit is contained in:
Benjamin Bouvier
2019-08-01 17:05:38 +02:00
parent f0d7438728
commit 627ba24b59
5 changed files with 27 additions and 27 deletions

View File

@@ -16,8 +16,9 @@ ebb0(v0: i64):
; nextln: brif uge $oob, ebb2
; nextln: fallthrough $(inb=$EBB)
; check: $inb:
; nextln: $(final_idx=$V) = uextend.i64 $idx
; nextln: $(base=$V) = jump_table_base.i64 jt0
; nextln: $(rel_addr=$V) = jump_table_entry.i64 $idx, $base, 4, jt0
; nextln: $(rel_addr=$V) = jump_table_entry $final_idx, $base, 4, jt0
; nextln: $(addr=$V) = iadd $base, $rel_addr
; nextln: indirect_jump_table_br $addr, jt0

View File

@@ -14,7 +14,7 @@ ebb1: ; the loop!
fallthrough ebb2
ebb2:
v1 = iconst.i32 -14
v1 = iconst.i64 -14
v8 = ifcmp_imm v1, 2
brif uge v8, ebb1
jump ebb3
@@ -25,7 +25,7 @@ ebb3:
v7 = iadd v5, v6
indirect_jump_table_br v7, jt0
; check: ebb2:
; nextln: v8 = ifcmp_imm.i32 v1, 2
; nextln: v8 = ifcmp_imm.i64 v1, 2
; nextln: brif uge v8, ebb1
; nextln: jump ebb3
; check: ebb3: