Add general legalization for the select instruction.

This commit is contained in:
Jakob Stoklund Olesen
2017-09-26 13:38:06 -07:00
parent ce767be703
commit 6ff681a90d
4 changed files with 89 additions and 1 deletions

View File

@@ -68,3 +68,13 @@ ebb0:
; check: $v1 = bitcast.f64 $tmp
return v1
}
function %select_f64(f64, f64, i32) -> f64 {
ebb0(v0: f64, v1: f64, v2: i32):
v3 = select v2, v0, v1
; check: brnz v2, $(new=$EBB)($v0)
; nextln: jump $new($v1)
; check: $new($v3: f64):
; nextln: return $v3
return v3
}

View File

@@ -0,0 +1,32 @@
; Test basic code generation for the select WebAssembly instruction.
test compile
set is_64bit=0
isa intel haswell
set is_64bit=1
isa intel haswell
function %select_i32(i32, i32, i32) -> i32 {
ebb0(v0: i32, v1: i32, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_i64(i64, i64, i32) -> i64 {
ebb0(v0: i64, v1: i64, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_f32(f32, f32, i32) -> f32 {
ebb0(v0: f32, v1: f32, v2: i32):
v3 = select v2, v0, v1
return v3
}
function %select_f64(f64, f64, i32) -> f64 {
ebb0(v0: f64, v1: f64, v2: i32):
v3 = select v2, v0, v1
return v3
}