aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2025-08-17 21:39:17 +0300
committerDimitar Dimitrov <dimitar@dinux.eu>2025-08-21 21:43:05 +0300
commit625af54662b4ff95c40d7b91fbb047ada6b06622 (patch)
tree0ad96c668aac627573ca384999b43559438bd107 /gcc
parent352cc9b57b2cfd62e37c962b6d2a83ed6d4827d2 (diff)
downloadgcc-625af54662b4ff95c40d7b91fbb047ada6b06622.zip
gcc-625af54662b4ff95c40d7b91fbb047ada6b06622.tar.gz
gcc-625af54662b4ff95c40d7b91fbb047ada6b06622.tar.bz2
pru: libgcc: Add software implementation for multiplication
For cores without a hardware multiplier, set respective optabs with library functions which use software implementation of multiplication. The implementation was copied from the RL78 backend. gcc/ChangeLog: * config/pru/pru.cc (pru_init_libfuncs): Set softmpy libgcc functions for optab multiplication entries if TARGET_OPT_MUL option is not set. libgcc/ChangeLog: * config/pru/libgcc-eabi.ver: Add __pruabi_softmpyi and __pruabi_softmpyll symbols. * config/pru/t-pru: Add softmpy source files. * config/pru/pru-softmpy.h: New file. * config/pru/softmpyi.c: New file. * config/pru/softmpyll.c: New file. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/pru/pru.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/config/pru/pru.cc b/gcc/config/pru/pru.cc
index 322e319..3fdc56e 100644
--- a/gcc/config/pru/pru.cc
+++ b/gcc/config/pru/pru.cc
@@ -941,10 +941,19 @@ pru_init_libfuncs (void)
/* Long long. */
set_optab_libfunc (ashr_optab, DImode, "__pruabi_asrll");
- set_optab_libfunc (smul_optab, DImode, "__pruabi_mpyll");
set_optab_libfunc (ashl_optab, DImode, "__pruabi_lslll");
set_optab_libfunc (lshr_optab, DImode, "__pruabi_lsrll");
+ if (TARGET_OPT_MUL)
+ {
+ set_optab_libfunc (smul_optab, DImode, "__pruabi_mpyll");
+ }
+ else
+ {
+ set_optab_libfunc (smul_optab, DImode, "__pruabi_softmpyll");
+ set_optab_libfunc (smul_optab, SImode, "__pruabi_softmpyi");
+ }
+
set_optab_libfunc (sdiv_optab, SImode, "__pruabi_divi");
set_optab_libfunc (udiv_optab, SImode, "__pruabi_divu");
set_optab_libfunc (smod_optab, SImode, "__pruabi_remi");