Add a trapif instruction.

This is a conditional trap controlled by integer CPU flags.
Compare to brif.
This commit is contained in:
Jakob Stoklund Olesen
2018-02-08 14:39:06 -08:00
parent 3eeef1c752
commit 11c721934c
8 changed files with 49 additions and 0 deletions

View File

@@ -210,3 +210,18 @@ ebb0:
; 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
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: return
; nextln: }