Add tests for branch order and branch comparison folding.
This commit is contained in:
committed by
Benjamin Bouvier
parent
947130be81
commit
89a2dd9414
@@ -16,8 +16,8 @@ ebb2:
|
||||
; sameln: function %brif_to_brz_fold
|
||||
; nextln: ebb0(v0: i32):
|
||||
; nextln: v1 = ifcmp_imm v0, 0
|
||||
; nextln: brz v0, ebb1
|
||||
; nextln: jump ebb2
|
||||
; nextln: brnz v0, ebb2
|
||||
; nextln: fallthrough ebb1
|
||||
; nextln:
|
||||
; nextln: ebb1:
|
||||
; nextln: v2 = iconst.i32 1
|
||||
@@ -27,3 +27,57 @@ ebb2:
|
||||
; nextln: v3 = iconst.i32 2
|
||||
; nextln: return v3
|
||||
; nextln: }
|
||||
|
||||
function %brif_inversion(i32) -> i32 {
|
||||
ebb0(v0: i32):
|
||||
v1 = ifcmp_imm v0, 42
|
||||
brif ugt v1, ebb1
|
||||
jump ebb2
|
||||
ebb1:
|
||||
v2 = iconst.i32 1
|
||||
return v2
|
||||
ebb2:
|
||||
v3 = iconst.i32 2
|
||||
return v3
|
||||
}
|
||||
; sameln: function %brif_inversion
|
||||
; nextln: ebb0(v0: i32):
|
||||
; nextln: v1 = ifcmp_imm v0, 42
|
||||
; nextln: brif ule v1, ebb2
|
||||
; nextln: fallthrough ebb1
|
||||
; nextln:
|
||||
; nextln: ebb1:
|
||||
; nextln: v2 = iconst.i32 1
|
||||
; nextln: return v2
|
||||
; nextln:
|
||||
; nextln: ebb2:
|
||||
; nextln: v3 = iconst.i32 2
|
||||
; nextln: return v3
|
||||
; nextln: }
|
||||
|
||||
function %brff_inversion(f32, f32) -> i32 {
|
||||
ebb0(v0: f32, v1: f32):
|
||||
v2 = ffcmp v0, v1
|
||||
brff gt v2, ebb1
|
||||
jump ebb2
|
||||
ebb1:
|
||||
v3 = iconst.i32 1
|
||||
return v3
|
||||
ebb2:
|
||||
v4 = iconst.i32 2
|
||||
return v4
|
||||
}
|
||||
; sameln: function %brff_inversion
|
||||
; nextln: ebb0(v0: f32, v1: f32):
|
||||
; nextln: v2 = ffcmp v0, v1
|
||||
; nextln: brff ule v2, ebb2
|
||||
; nextln: fallthrough ebb1
|
||||
; nextln:
|
||||
; nextln: ebb1:
|
||||
; nextln: v3 = iconst.i32 1
|
||||
; nextln: return v3
|
||||
; nextln:
|
||||
; nextln: ebb2:
|
||||
; nextln: v4 = iconst.i32 2
|
||||
; nextln: return v4
|
||||
; nextln: }
|
||||
|
||||
@@ -63,8 +63,8 @@ ebb2:
|
||||
; nextln: v1 = bint.i32 v3
|
||||
; nextln: v2 = select v3, v1, v1
|
||||
; nextln: trapz v3, user0
|
||||
; nextln: brz v3, ebb1
|
||||
; nextln: jump ebb2
|
||||
; nextln: brnz v3, ebb2
|
||||
; nextln: fallthrough ebb1
|
||||
|
||||
function %irsub_imm(i32) -> i32 {
|
||||
ebb0(v0: i32):
|
||||
|
||||
Reference in New Issue
Block a user