public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/2] xtensa: Reflect the 32-bit Integer Divide Option
@ 2022-05-06 10:34 Takayuki 'January June' Suwa
  2022-05-13  9:37 ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2022-05-06 10:34 UTC (permalink / raw)
  To: gcc-patches

On Espressif's ESP8266 (based on Tensilica LX106, no hardware divider),
this patch reduces the size of each:

   __moddi3() @ libgcc.a :  969 -> 301 (saves 668)
   __divmoddi4()         : 1111 -> 426 (saves 685)
   __udivmoddi4()        : 1043 -> 319 (saves 724)

in bytes, respectively.

gcc/ChangeLog:

	* config/xtensa/xtensa.h (TARGET_HAS_NO_HW_DIVIDE): New macro
	definition.
---
  gcc/config/xtensa/xtensa.h | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 00e2930b30a..d25594f0c1f 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -75,6 +75,11 @@ along with GCC; see the file COPYING3.  If not see
  #define HAVE_AS_TLS 0
  #endif

+/* Define this if the target has no hardware divide instructions.  */
+#if !TARGET_DIV32
+#define TARGET_HAS_NO_HW_DIVIDE
+#endif
+
  \f
  /* Target CPU builtins.  */
  #define TARGET_CPU_CPP_BUILTINS()					\
-- 
2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] xtensa: Reflect the 32-bit Integer Divide Option
  2022-05-06 10:34 [PATCH 2/2] xtensa: Reflect the 32-bit Integer Divide Option Takayuki 'January June' Suwa
@ 2022-05-13  9:37 ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2022-05-13  9:37 UTC (permalink / raw)
  To: Takayuki 'January June' Suwa; +Cc: GCC Patches

On Fri, May 6, 2022 at 3:36 AM Takayuki 'January June' Suwa via
Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> On Espressif's ESP8266 (based on Tensilica LX106, no hardware divider),
> this patch reduces the size of each:
>
>    __moddi3() @ libgcc.a :  969 -> 301 (saves 668)
>    __divmoddi4()         : 1111 -> 426 (saves 685)
>    __udivmoddi4()        : 1043 -> 319 (saves 724)
>
> in bytes, respectively.
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.h (TARGET_HAS_NO_HW_DIVIDE): New macro
>         definition.
> ---
>   gcc/config/xtensa/xtensa.h | 5 +++++
>   1 file changed, 5 insertions(+)

Regtested for target=xtensa-linux-uclibc, there's new regression in
gcc.c-torture/execute/20101011-1.c
related to division by 0 implemented as an invalid opcode exception
that the kernel should convert to division by 0 signal, but does not.
It should be fixed in the kernel.

Committed to master.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-13  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 10:34 [PATCH 2/2] xtensa: Reflect the 32-bit Integer Divide Option Takayuki 'January June' Suwa
2022-05-13  9:37 ` Max Filippov

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).