summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-03-03 08:53:45 +0800
committerGitHub <[email protected]>2021-03-03 08:53:45 +0800
commit85ef7013aa8b93e60c38557ae9e42d954c5bd18f (patch)
tree26ced0f3e18a101a905cf9e8320f82d4e487a6ec /libcpu
parentd9b88ddf2be81826de1f16561286eeea7cf94e9b (diff)
parent360d7e48ab2d3c205b74523a075d92cbe3e72a7b (diff)
Merge pull request #4293 from enkiller/0201-2045
[libcpu][cm33] 修复不同优化等级,函数行为不一致的问题
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/arm/cortex-m33/cpuport.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c
index 42b5798507..41325105d7 100644
--- a/libcpu/arm/cortex-m33/cpuport.c
+++ b/libcpu/arm/cortex-m33/cpuport.c
@@ -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)
);