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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user