Add legalization patterns for fabs and fneg.

These sign bit manipulations need to use a -0.0 floating point constant
which we didn't have a way of materializing previously.

Add a ieee32.bits(0x...) syntax to the Python AST nodes that creates am
f32 immediate value with the exact requested bitwise representation.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-25 12:12:47 -07:00
parent ba1c50d6c1
commit 8deca67968
5 changed files with 75 additions and 6 deletions

View File

@@ -17,8 +17,18 @@ ebb0:
; Unary operations
; function %f32_abs(f32) -> f32
; function %f32_neg(f32) -> f32
function %f32_abs(f32) -> f32 {
ebb0(v0: f32):
v1 = fabs v0
return v1
}
function %f32_neg(f32) -> f32 {
ebb0(v0: f32):
v1 = fneg v0
return v1
}
; function %f32_sqrt(f32) -> f32
; function %f32_ceil(f32) -> f32
; function %f32_floor(f32) -> f32

View File

@@ -14,8 +14,18 @@ ebb0:
; Unary operations
; function %f64_abs(f64) -> f64
; function %f64_neg(f64) -> f64
function %f64_abs(f64) -> f64 {
ebb0(v0: f64):
v1 = fabs v0
return v1
}
function %f64_neg(f64) -> f64 {
ebb0(v0: f64):
v1 = fneg v0
return v1
}
; function %f64_sqrt(f64) -> f64
; function %f64_ceil(f64) -> f64
; function %f64_floor(f64) -> f64