Merge pull request #4293 from enkiller/0201-2045

[libcpu][cm33] 修复不同优化等级,函数行为不一致的问题
This commit is contained in:
Bernard Xiong 2021-03-03 08:53:45 +08:00 committed by GitHub
commit 85ef7013aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -473,17 +473,13 @@ exit
#elif defined(__CLANG_ARM)
int __rt_ffs(int value)
{
__asm volatile(
"CMP r0, #0x00 \n"
"BEQ 1f \n"
if (value == 0) return value;
__asm volatile(
"RBIT r0, r0 \n"
"CLZ r0, r0 \n"
"ADDS r0, r0, #0x01 \n"
"1: \n"
"BX lr \n"
: "=r"(value)
: "r"(value)
);