public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libgcc pru: Define TARGET_HAS_NO_HW_DIVIDE
@ 2023-05-01  8:19 Dimitar Dimitrov
  0 siblings, 0 replies; only message in thread
From: Dimitar Dimitrov @ 2023-05-01  8:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: Dimitar Dimitrov

This patch aligns the configuration to the actual PRU capabilities. It
also reduces the size of the affected libgcc functions.

For a real-world project using integer arithmetics the savings
are significant:

  Before:
     text    data     bss     dec     hex filename
     3688     865     544    5097    13e9 hc-sr04-range-sensor.elf

  With TARGET_HAS_NO_HW_DIVIDE defined:
     text    data     bss     dec     hex filename
     2824     865     544    4233    1089 hc-sr04-range-sensor.elf

Execution speed also appears to have improved. The moddi3 function is
now executed in half the CPU cycles.

Cherry-picked from the recent change for the CRIS port. Pushed to trunk.

libgcc/ChangeLog:

	* config/pru/t-pru (HOST_LIBGCC2_CFLAGS): Add
	-DTARGET_HAS_NO_HW_DIVIDE.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
 libgcc/config/pru/t-pru | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgcc/config/pru/t-pru b/libgcc/config/pru/t-pru
index a5b1871e52d..7d5f5ee4261 100644
--- a/libgcc/config/pru/t-pru
+++ b/libgcc/config/pru/t-pru
@@ -42,6 +42,9 @@ LIB2ADD += \
 
 HOST_LIBGCC2_CFLAGS += -Os -ffunction-sections -fdata-sections
 
+# Use an appropriate implementation when implementing DImode division.
+HOST_LIBGCC2_CFLAGS += -DTARGET_HAS_NO_HW_DIVIDE
+
 LIB2FUNCS_EXCLUDE = _muldi3
 
 SHLIB_MAPFILES += $(srcdir)/config/pru/libgcc-eabi.ver
-- 
2.40.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-01  8:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-01  8:19 [committed] libgcc pru: Define TARGET_HAS_NO_HW_DIVIDE Dimitar Dimitrov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).