Add x86 encoding for SIMD icmp eq

Also adds a predicate for matching the `eq` IntCC code (TODO this should be replaced by something more general)
This commit is contained in:
Andrew Brown
2019-09-03 15:15:55 -07:00
parent 702155b19b
commit a3db30d97e
7 changed files with 134 additions and 0 deletions

View File

@@ -10,6 +10,8 @@
//! dead code warning.
use crate::ir;
use crate::ir::condcodes::IntCC;
use std::string::ToString;
/// Check that an integer value is zero.
#[allow(dead_code)]
@@ -83,6 +85,14 @@ pub fn has_length_of(value_list: &ir::ValueList, num: usize, func: &ir::Function
value_list.len(&func.dfg.value_lists) == num
}
#[allow(dead_code)]
pub fn match_condition_code_to_str(
condition_code: IntCC,
stringified_condition_code: &str,
) -> bool {
condition_code.to_string().eq(stringified_condition_code)
}
#[cfg(test)]
mod tests {
use super::*;
@@ -136,4 +146,10 @@ mod tests {
assert!(!is_all_ones_128_bit(&[0; 16]));
assert!(is_all_ones_128_bit(&[0xff; 16]));
}
#[test]
fn condition_code() {
assert!(match_condition_code_to_str(IntCC::Equal, "eq"));
assert!(!match_condition_code_to_str(IntCC::Equal, "ne"));
}
}