Use 'xor r, r' to set registers to 0 instead of mov (#766)

This commit is contained in:
Andy Wortman
2019-09-16 14:35:55 +00:00
committed by Benjamin Bouvier
parent b95508c51a
commit 99380fad1a
9 changed files with 193 additions and 7 deletions

View File

@@ -11,6 +11,12 @@
use crate::ir;
/// Check that an integer value is zero.
#[allow(dead_code)]
pub fn is_zero_int<T: Into<i64>>(x: T) -> bool {
x.into() == 0
}
/// 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 {