Add Intel encodings for the fcmp instruction.

Not all floating point condition codes are directly supported by the
ucimiss/ucomisd instructions. Some inequalities need to be reversed and
eq+ne require two separate tests.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-26 09:54:54 -07:00
parent 79968a2325
commit 7fb6159a85
9 changed files with 342 additions and 10 deletions

View File

@@ -0,0 +1,50 @@
; Test code generation for WebAssembly f32 comparison operators.
test compile
set is_64bit=0
isa intel haswell
set is_64bit=1
isa intel haswell
function %f32_eq(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_ne(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_lt(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp lt v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_gt(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp gt v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_le(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp le v0, v1
v3 = bint.i32 v2
return v3
}
function %f32_ge(f32, f32) -> i32 {
ebb0(v0: f32, v1: f32):
v2 = fcmp ge v0, v1
v3 = bint.i32 v2
return v3
}

View File

@@ -0,0 +1,50 @@
; Test code generation for WebAssembly f64 comparison operators.
test compile
set is_64bit=0
isa intel haswell
set is_64bit=1
isa intel haswell
function %f64_eq(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp eq v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_ne(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp ne v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_lt(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp lt v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_gt(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp gt v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_le(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp le v0, v1
v3 = bint.i32 v2
return v3
}
function %f64_ge(f64, f64) -> i32 {
ebb0(v0: f64, v1: f64):
v2 = fcmp ge v0, v1
v3 = bint.i32 v2
return v3
}