Add Intel legalization for fmin and fmax.
The native x86_fmin and x86_fmax instructions don't behave correctly for NaN inputs and when comparing +0.0 to -0.0, so we need separate branches for those cases.
This commit is contained in:
@@ -78,3 +78,22 @@ ebb0(v0: f64, v1: f64, v2: i32):
|
||||
; nextln: return $v3
|
||||
return v3
|
||||
}
|
||||
|
||||
function %f32_min(f32, f32) -> f32 {
|
||||
ebb0(v0: f32, v1: f32):
|
||||
v2 = fmin v0, v1
|
||||
return v2
|
||||
; check: $(vnat=$V) = x86_fmin $v0, $v1
|
||||
; nextln: jump $(done=$EBB)($vnat)
|
||||
|
||||
; check: $(uno=$EBB):
|
||||
; nextln: $(vuno=$V) = fadd.f32 $v0, $v1
|
||||
; nextln: jump $(done=$EBB)($vuno)
|
||||
|
||||
; check: $(ueq=$EBB):
|
||||
; check: $(veq=$V) = bor.f32 $v0, $v1
|
||||
; nextln: jump $(done=$EBB)($veq)
|
||||
|
||||
; check: $done($v2: f32):
|
||||
; nextln: return $v2
|
||||
}
|
||||
|
||||
@@ -85,8 +85,17 @@ ebb0(v0: f32, v1: f32):
|
||||
return v2
|
||||
}
|
||||
|
||||
; function %f32_min(f32, f32) -> f32
|
||||
; function %f32_max(f32, f32) -> f32
|
||||
function %f32_min(f32, f32) -> f32 {
|
||||
ebb0(v0: f32, v1: f32):
|
||||
v2 = fmin v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
function %f32_max(f32, f32) -> f32 {
|
||||
ebb0(v0: f32, v1: f32):
|
||||
v2 = fmax v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
function %f32_copysign(f32, f32) -> f32 {
|
||||
ebb0(v0: f32, v1: f32):
|
||||
|
||||
@@ -82,8 +82,17 @@ ebb0(v0: f64, v1: f64):
|
||||
return v2
|
||||
}
|
||||
|
||||
; function %f64_min(f64, f64) -> f64
|
||||
; function %f64_max(f64, f64) -> f64
|
||||
function %f64_min(f64, f64) -> f64 {
|
||||
ebb0(v0: f64, v1: f64):
|
||||
v2 = fmin v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
function %f64_max(f64, f64) -> f64 {
|
||||
ebb0(v0: f64, v1: f64):
|
||||
v2 = fmax v0, v1
|
||||
return v2
|
||||
}
|
||||
|
||||
function %f64_copysign(f64, f64) -> f64 {
|
||||
ebb0(v0: f64, v1: f64):
|
||||
|
||||
Reference in New Issue
Block a user