diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2021-10-18 04:29:27 -0700 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2022-03-09 14:02:40 -0800 |
commit | dbf4ed894c0fd85d421f7b3b9758ce95398d2925 (patch) | |
tree | be741f6adb095349d4128f0b792a5b5637ab53b5 /arch/xtensa/include | |
parent | 8c9ab55c0fbdc76cb876140c2dad75a610bb23ef (diff) | |
download | linux-dbf4ed894c0fd85d421f7b3b9758ce95398d2925.tar.gz |
xtensa: add helpers for division, remainder and shifts
Don't rely on libgcc presence, build own versions of the helpers with
correct ABI.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/include')
-rw-r--r-- | arch/xtensa/include/asm/asmmacro.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/xtensa/include/asm/asmmacro.h b/arch/xtensa/include/asm/asmmacro.h index 809c507d1825..3190157950fa 100644 --- a/arch/xtensa/include/asm/asmmacro.h +++ b/arch/xtensa/include/asm/asmmacro.h @@ -191,6 +191,40 @@ #endif .endm + .macro do_nsau cnt, val, tmp, a +#if XCHAL_HAVE_NSA + nsau \cnt, \val +#else + mov \a, \val + movi \cnt, 0 + extui \tmp, \a, 16, 16 + bnez \tmp, 0f + movi \cnt, 16 + slli \a, \a, 16 +0: + extui \tmp, \a, 24, 8 + bnez \tmp, 1f + addi \cnt, \cnt, 8 + slli \a, \a, 8 +1: + movi \tmp, __nsau_data + extui \a, \a, 24, 8 + add \tmp, \tmp, \a + l8ui \tmp, \tmp, 0 + add \cnt, \cnt, \tmp +#endif /* !XCHAL_HAVE_NSA */ + .endm + + .macro do_abs dst, src, tmp +#if XCHAL_HAVE_ABS + abs \dst, \src +#else + neg \tmp, \src + movgez \tmp, \src, \src + mov \dst, \tmp +#endif + .endm + #define XTENSA_STACK_ALIGNMENT 16 #if defined(__XTENSA_WINDOWED_ABI__) |