[libcpu][cm33] 修复不同优化等级,函数行为不一致的问题
This commit is contained in:
parent
ef8b984fa1
commit
360d7e48ab
|
@ -473,17 +473,13 @@ exit
|
||||||
#elif defined(__CLANG_ARM)
|
#elif defined(__CLANG_ARM)
|
||||||
int __rt_ffs(int value)
|
int __rt_ffs(int value)
|
||||||
{
|
{
|
||||||
__asm volatile(
|
if (value == 0) return value;
|
||||||
"CMP r0, #0x00 \n"
|
|
||||||
"BEQ 1f \n"
|
|
||||||
|
|
||||||
|
__asm volatile(
|
||||||
"RBIT r0, r0 \n"
|
"RBIT r0, r0 \n"
|
||||||
"CLZ r0, r0 \n"
|
"CLZ r0, r0 \n"
|
||||||
"ADDS r0, r0, #0x01 \n"
|
"ADDS r0, r0, #0x01 \n"
|
||||||
|
|
||||||
"1: \n"
|
|
||||||
"BX lr \n"
|
|
||||||
|
|
||||||
: "=r"(value)
|
: "=r"(value)
|
||||||
: "r"(value)
|
: "r"(value)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue