[arm] fix aarch64 cls intrinsic
This commit is contained in:
parent
e0176b278f
commit
ffc69c752e
1 changed files with 4 additions and 6 deletions
|
|
@ -39,10 +39,9 @@ pub unsafe fn _rbit_u64(x: u64) -> u64 {
|
|||
/// When all bits of the operand are set it returns the size of the operand in
|
||||
/// bits.
|
||||
#[inline(always)]
|
||||
// LLVM Bug (should be cls): https://bugs.llvm.org/show_bug.cgi?id=31802
|
||||
#[cfg_attr(test, assert_instr(clz))]
|
||||
#[cfg_attr(test, assert_instr(cls))]
|
||||
pub unsafe fn _cls_u32(x: u32) -> u32 {
|
||||
u32::leading_zeros(!x) as u32
|
||||
u32::leading_zeros(((((((x as i32) >> 31) as u32) ^ x) << 1) | 1)) as u32
|
||||
}
|
||||
|
||||
/// Counts the leading most significant bits set.
|
||||
|
|
@ -50,8 +49,7 @@ pub unsafe fn _cls_u32(x: u32) -> u32 {
|
|||
/// When all bits of the operand are set it returns the size of the operand in
|
||||
/// bits.
|
||||
#[inline(always)]
|
||||
// LLVM Bug (should be cls): https://bugs.llvm.org/show_bug.cgi?id=31802
|
||||
#[cfg_attr(test, assert_instr(clz))]
|
||||
#[cfg_attr(test, assert_instr(cls))]
|
||||
pub unsafe fn _cls_u64(x: u64) -> u64 {
|
||||
u64::leading_zeros(!x) as u64
|
||||
u64::leading_zeros(((((((x as i64) >> 63) as u64) ^ x) << 1) | 1)) as u64
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue