More i8 legalizations (#1253)

* Legalize stack_{load,store}.i8, fixes #433
* Legalize select.i8, cc: #466
* Legalize brz.i8 and brnz.i8, cc: #1117
This commit is contained in:
bjorn3
2019-12-04 18:16:22 +01:00
committed by Andrew Brown
parent b342cbdd64
commit 4cc0241f37
5 changed files with 116 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
test run
target x86_64
function u0:0() -> b1 {
ebb0:
v0 = iconst.i8 0
brz v0, ebb1
jump ebb2
ebb1:
v1 = bconst.b1 true
return v1
ebb2:
v2 = bconst.b1 false
return v2
}
; run
function u0:1() -> b1 {
ebb0:
v0 = iconst.i8 0
brnz v0, ebb1
jump ebb2
ebb1:
v1 = bconst.b1 false
return v1
ebb2:
v2 = bconst.b1 true
return v2
}
; run

View File

@@ -0,0 +1,38 @@
test compile
target x86_64
function u0:0() -> b1 {
ebb0:
v0 = iconst.i8 0
; check: v0 = iconst.i8 0
brz v0, ebb1
; nextln: v3 = uextend.i32 v0
; nextln: brz v3, ebb1
jump ebb2
ebb1:
v1 = bconst.b1 true
return v1
ebb2:
v2 = bconst.b1 false
return v2
}
function u0:1() -> b1 {
ebb0:
v0 = iconst.i8 0
; check: v0 = iconst.i8 0
brnz v0, ebb1
; nextln: v3 = uextend.i32 v0
; nextln: brnz v3, ebb1
jump ebb2
ebb1:
v1 = bconst.b1 false
return v1
ebb2:
v2 = bconst.b1 true
return v2
}

View File

@@ -0,0 +1,8 @@
test compile
target x86_64
function u0:0(b1, i8, i8) -> i8 {
ebb0(v0: b1, v1: i8, v2: i8):
v3 = select v0, v1, v2
return v3
}

View File

@@ -0,0 +1,19 @@
test compile
target x86_64
function u0:0(i8) -> i8 {
ss0 = explicit_slot 1
ebb0(v0: i8):
stack_store v0, ss0
; check: v2 = stack_addr.i64 ss0
; nextln: v3 = uextend.i32 v0
; nextln: istore8 notrap aligned v3, v2
v1 = stack_load.i8 ss0
; check: v4 = stack_addr.i64 ss0
; nextln: v5 = uload8.i32 notrap aligned v4
; nextln: v1 = ireduce.i8 v5
return v1
}