Cranelift(Aarch64): Optimize lowering of icmps with immediates (#5252)

We can encode more constants into 12-bit immediates if we do the following
rewrite for comparisons with odd constants:

        A >= B + 1
    ==> A - 1 >= B
    ==> A > B
This commit is contained in:
Nick Fitzgerald
2022-11-15 09:18:55 -08:00
committed by GitHub
parent 6dcdabf37e
commit 9967782726
7 changed files with 236 additions and 51 deletions

View File

@@ -90,6 +90,11 @@ macro_rules! isle_common_prelude_methods {
0 == value
}
#[inline]
fn u64_is_odd(&mut self, x: u64) -> Option<bool> {
Some(x & 1 == 1)
}
#[inline]
fn u64_sextend_u32(&mut self, x: u64) -> Option<u64> {
Some(x as u32 as i32 as i64 as u64)