Add custom legalization for conditional traps.

The expansion of these instructions requires the CFG to be modified,
something the Python XForms can't yet do.
This commit is contained in:
Jakob Stoklund Olesen
2017-08-25 12:40:43 -07:00
parent 6d9198d55f
commit 217434b474
3 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
; Test the custom legalizations.
test legalizer
isa intel
set is_64bit
isa intel
; regex: V=v\d+
; regex: EBB=ebb\d+
function %cond_trap(i32) {
ebb0(v1: i32):
trapz v1
return
; check: $ebb0($v1: i32):
; nextln: brnz $v1, $(new=$EBB)
; nextln: trap
; check: $new:
; nextln: return
}
function %cond_trap2(i32) {
ebb0(v1: i32):
trapnz v1
return
; check: $ebb0($v1: i32):
; nextln: brz $v1, $(new=$EBB)
; nextln: trap
; check: $new:
; nextln: return
}