public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* DI support in libgcc2
@ 2002-07-19 10:46 Hartmut Schirmer
  2002-07-19 14:29 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Hartmut Schirmer @ 2002-07-19 10:46 UTC (permalink / raw)
  To: gcc

Hi,

Several functions in libgcc2.c call __negdi2 even if
the target supports negating a DI.

I tried this hack for i386 with gcc 3.1

#include "insn-flags.h"

DWtype
__negdi2 (DWtype u)
{
#if HAVE_negdi2
  return -u;
#else
  ...
  
to get an optimized version. The same could be done
for other support routines (shifting, mul, mod, ...)

Is this the right way to go ?

Hartmut

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

* Re: DI support in libgcc2
  2002-07-19 10:46 DI support in libgcc2 Hartmut Schirmer
@ 2002-07-19 14:29 ` Richard Henderson
  2002-07-21 16:38   ` Hartmut Schirmer
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2002-07-19 14:29 UTC (permalink / raw)
  To: Hartmut Schirmer; +Cc: gcc

On Fri, Jul 19, 2002 at 02:33:55PM +0200, Hartmut Schirmer wrote:
> Several functions in libgcc2.c call __negdi2 even if
> the target supports negating a DI.
[...]
> Is this the right way to go ?

No.  Should use the - operator everywhere except
in __negdi2 itself, which will cause the compiler
to call the __negdi2 function if needed.


r~

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

* Re: DI support in libgcc2
  2002-07-19 14:29 ` Richard Henderson
@ 2002-07-21 16:38   ` Hartmut Schirmer
  2002-07-21 23:45     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Hartmut Schirmer @ 2002-07-21 16:38 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc, gcc-patches

Hi,

patch for 3.1 included. The patch also works for
the head revision.

Hartmut

----- Original Message -----
From: "Richard Henderson" <rth@redhat.com>
To: "Hartmut Schirmer" <hartmut.schirmer@arcor.de>
Cc: <gcc@gcc.gnu.org>
Sent: Friday, July 19, 2002 7:00 PM
Subject: Re: DI support in libgcc2


> On Fri, Jul 19, 2002 at 02:33:55PM +0200, Hartmut Schirmer wrote:
> > Several functions in libgcc2.c call __negdi2 even if
> > the target supports negating a DI.
> [...]
> > Is this the right way to go ?
>
> No.  Should use the - operator everywhere except
> in __negdi2 itself, which will cause the compiler
> to call the __negdi2 function if needed.
>
>
> r~

2002-07-21  Hartmut Schirmer" <hartmut.schirmer@arcor.de>

* libgcc2.c: Use unary minus instead of inlined version of __negdi2

*** libgcc2.orig Wed Apr  3 04:20:52 2002
--- libgcc2.c Sun Jul 21 20:17:37 2002
***************
*** 45,54 ****

  #include "libgcc2.h"
  \f
! #if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
! #if defined (L_divdi3) || defined (L_moddi3)
! static inline
! #endif
  DWtype
  __negdi2 (DWtype u)
  {
--- 45,51 ----

  #include "libgcc2.h"
  \f
! #if defined (L_negdi2)
  DWtype
  __negdi2 (DWtype u)
  {
***************
*** 734,747 ****

    if (uu.s.high < 0)
      c = ~c,
!     uu.ll = __negdi2 (uu.ll);
    if (vv.s.high < 0)
      c = ~c,
!     vv.ll = __negdi2 (vv.ll);

    w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
    if (c)
!     w = __negdi2 (w);

    return w;
  }
--- 731,744 ----

    if (uu.s.high < 0)
      c = ~c,
!     uu.ll = -uu.ll;
    if (vv.s.high < 0)
      c = ~c,
!     vv.ll = -vv.ll;

    w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
    if (c)
!     w = -w;

    return w;
  }
***************
*** 760,772 ****

    if (uu.s.high < 0)
      c = ~c,
!     uu.ll = __negdi2 (uu.ll);
    if (vv.s.high < 0)
!     vv.ll = __negdi2 (vv.ll);

    (void) __udivmoddi4 (uu.ll, vv.ll, &w);
    if (c)
!     w = __negdi2 (w);

    return w;
  }
--- 757,769 ----

    if (uu.s.high < 0)
      c = ~c,
!     uu.ll = -uu.ll;
    if (vv.s.high < 0)
!     vv.ll = -vv.ll;

    (void) __udivmoddi4 (uu.ll, vv.ll, &w);
    if (c)
!     w = -w;

    return w;
  }


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

* Re: DI support in libgcc2
  2002-07-21 16:38   ` Hartmut Schirmer
@ 2002-07-21 23:45     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2002-07-21 23:45 UTC (permalink / raw)
  To: Hartmut Schirmer; +Cc: gcc, gcc-patches

On Sun, Jul 21, 2002 at 10:28:57PM +0200, Hartmut Schirmer wrote:
> * libgcc2.c: Use unary minus instead of inlined version of __negdi2

Applied.


r~

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

end of thread, other threads:[~2002-07-22  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-19 10:46 DI support in libgcc2 Hartmut Schirmer
2002-07-19 14:29 ` Richard Henderson
2002-07-21 16:38   ` Hartmut Schirmer
2002-07-21 23:45     ` Richard Henderson

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