Optimize 0.0 floating point constants. (#344)

* Optimize 0.0 floating point constants. Rather than using the existing
process of emitting bit patterns and moving them into floating point
registers, use the `xorps` instruction to zero out the register.

* is_zero predicate function will not accept negative zero. Fixed formatting for encoding recipe and filetests.
This commit is contained in:
data-pup
2018-05-24 17:16:25 -04:00
committed by Dan Gohman
parent 4afb28ef59
commit 191bab162b
6 changed files with 134 additions and 2 deletions

View File

@@ -11,6 +11,20 @@
use ir;
/// Check that a 64-bit floating point value is zero.
#[allow(dead_code)]
pub fn is_zero_64_bit_float<T: Into<ir::immediates::Ieee64>>(x: T) -> bool {
let x64 = x.into();
x64.bits() == 0
}
/// Check that a 32-bit floating point value is zero.
#[allow(dead_code)]
pub fn is_zero_32_bit_float<T: Into<ir::immediates::Ieee32>>(x: T) -> bool {
let x32 = x.into();
x32.bits() == 0
}
/// Check that `x` is the same as `y`.
#[allow(dead_code)]
pub fn is_equal<T: Eq + Copy, O: Into<T> + Copy>(x: T, y: O) -> bool {