mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
[arm] fix aarch64 cls intrinsic
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user