Add standard expansions for fcopysign.
This is also just a sign bit manipulation.
This commit is contained in:
@@ -87,4 +87,9 @@ ebb0(v0: f32, v1: f32):
|
|||||||
|
|
||||||
; function %f32_min(f32, f32) -> f32
|
; function %f32_min(f32, f32) -> f32
|
||||||
; function %f32_max(f32, f32) -> f32
|
; function %f32_max(f32, f32) -> f32
|
||||||
; function %f32_copysign(f32, f32) -> f32
|
|
||||||
|
function %f32_copysign(f32, f32) -> f32 {
|
||||||
|
ebb0(v0: f32, v1: f32):
|
||||||
|
v2 = fcopysign v0, v1
|
||||||
|
return v2
|
||||||
|
}
|
||||||
|
|||||||
@@ -84,4 +84,9 @@ ebb0(v0: f64, v1: f64):
|
|||||||
|
|
||||||
; function %f64_min(f64, f64) -> f64
|
; function %f64_min(f64, f64) -> f64
|
||||||
; function %f64_max(f64, f64) -> f64
|
; function %f64_max(f64, f64) -> f64
|
||||||
; function %f64_copysign(f64, f64) -> f64
|
|
||||||
|
function %f64_copysign(f64, f64) -> f64 {
|
||||||
|
ebb0(v0: f64, v1: f64):
|
||||||
|
v2 = fcopysign v0, v1
|
||||||
|
return v2
|
||||||
|
}
|
||||||
|
|||||||
@@ -226,3 +226,11 @@ for ty, minus_zero in [
|
|||||||
b << minus_zero,
|
b << minus_zero,
|
||||||
a << bxor(x, b),
|
a << bxor(x, b),
|
||||||
))
|
))
|
||||||
|
expand.legalize(
|
||||||
|
a << insts.fcopysign.bind(ty)(x, y),
|
||||||
|
Rtl(
|
||||||
|
b << minus_zero,
|
||||||
|
a1 << band_not(x, b),
|
||||||
|
a2 << band(y, b),
|
||||||
|
a << bor(a1, a2)
|
||||||
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user