Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-29 Thread Jeff Law via Gcc-patches
On 11/11/20 1:33 AM, Stefan Kanthak wrote: > Jakub Jelinek wrote: > >> On Tue, Nov 10, 2020 at 04:48:10PM -0700, Jeff Law via Gcc-patches wrote: @@ -486,10 +425,10 @@ SItype __bswapsi2 (SItype u) { - return u) & 0xff00) >> 24) - | (((u) & 0x00ff)

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Stefan Kanthak
Jeff Law wrote: [...] > By understanding how your proposed changes affect other processors, you > can write better changes that are more likely to get included. > Furthermore you can focus efforts on things that matter more in the real > world. DImode shifts in libgcc are _not_ useful to try

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Jeff Law via Gcc-patches
On 11/25/20 2:22 PM, Stefan Kanthak wrote: > Jakub Jelinek wrote: > >> On Wed, Nov 25, 2020 at 09:22:53PM +0100, Stefan Kanthak wrote: As Jakub has already indicated, your change will result in infinite recursion on avr.Ã, I happened to have a cr16 handy and it looks like it'd

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Stefan Kanthak
Jakub Jelinek wrote: > On Wed, Nov 25, 2020 at 09:22:53PM +0100, Stefan Kanthak wrote: >> > As Jakub has already indicated, your change will result in infinite >> > recursion on avr.Ã, I happened to have a cr16 handy and it looks like >> > it'd generate infinite recursion there too. >> >> JFTR:

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Jeff Law via Gcc-patches
On 11/25/20 1:22 PM, Stefan Kanthak wrote: > Jeff Law wrote: > >> On 11/24/20 8:40 AM, Stefan Kanthak wrote: >>> Andreas Schwab wrote: >>> On Nov 24 2020, Stefan Kanthak wrote: > 'nuff said What's your point? >>> Pinpoint deficiencies and bugs in GCC and libgcc, plus a

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 25, 2020 at 09:22:53PM +0100, Stefan Kanthak wrote: > > As Jakub has already indicated, your change will result in infinite > > recursion on avr. I happened to have a cr16 handy and it looks like > > it'd generate infinite recursion there too. > > JFTR: does GCC emit a warning then?

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Stefan Kanthak
Jeff Law wrote: > On 11/24/20 8:40 AM, Stefan Kanthak wrote: >> Andreas Schwab wrote: >> >>> On Nov 24 2020, Stefan Kanthak wrote: >>> 'nuff said >>> What's your point? >> Pinpoint deficiencies and bugs in GCC and libgcc, plus a counter >> example to your "argument"! >> I recommend careful

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-25 Thread Jeff Law via Gcc-patches
On 11/24/20 8:40 AM, Stefan Kanthak wrote: > Andreas Schwab wrote: > >> On Nov 24 2020, Stefan Kanthak wrote: >> >>> 'nuff said >> What's your point? > Pinpoint deficiencies and bugs in GCC and libgcc, plus a counter > example to your "argument"! > I recommend careful reading. Umm, you should

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-24 Thread Andreas Schwab
On Nov 24 2020, Stefan Kanthak wrote: > Pinpoint deficiencies and bugs in GCC and libgcc, plus a counter > example to your "argument"! In which way? > I recommend careful reading. Yes, I do. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-24 Thread Stefan Kanthak
Andreas Schwab wrote: > On Nov 24 2020, Stefan Kanthak wrote: > >> 'nuff said > > What's your point? Pinpoint deficiencies and bugs in GCC and libgcc, plus a counter example to your "argument"! I recommend careful reading. Stefan

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-24 Thread Andreas Schwab
On Nov 24 2020, Stefan Kanthak wrote: > 'nuff said What's your point? Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-24 Thread Stefan Kanthak
Andreas Schwab wrote 2020-11-11: > On Nov 10 2020, Stefan Kanthak wrote: > >> Eric Botcazou wrote: >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions is rather bad, it yields bad machine code at least on i386 and AMD64. Since GCC knows how to

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-23 Thread Jeff Law via Gcc-patches
On 11/10/20 2:09 PM, Jeff Law wrote: > On 11/10/20 1:14 PM, Jakub Jelinek via Gcc-patches wrote: >> On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: >>> Eric Botcazou wrote: >>> > The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() > functions > is

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-23 Thread Jeff Law via Gcc-patches
On 11/11/20 2:55 AM, Jakub Jelinek wrote: > On Wed, Nov 11, 2020 at 09:33:00AM +0100, Stefan Kanthak wrote: >> Ouch: that's but not the point here; what matters is the undefined behaviour >> of >> ((u) & 0x00ff) << 24 >> >> 0x00ff is a signed int, so (u) & 0x00ff is signed

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-11 Thread Joseph Myers
On Wed, 11 Nov 2020, Jakub Jelinek via Gcc-patches wrote: > So indeed, 0x80 << 24 is UB in C99/C11 and C++98, unclear in C89 and > well defined in C++11 and later. I don't know if C2X is considering > mandating two's complement and making it well defined like C++20 did. C2x requires two's

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 09:33:00AM +0100, Stefan Kanthak wrote: > Ouch: that's but not the point here; what matters is the undefined behaviour > of > ((u) & 0x00ff) << 24 > > 0x00ff is a signed int, so (u) & 0x00ff is signed too -- and producing > a negative value (or overflow)

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-11 Thread Stefan Kanthak
Jakub Jelinek wrote: > On Tue, Nov 10, 2020 at 04:48:10PM -0700, Jeff Law via Gcc-patches wrote: >> > @@ -486,10 +425,10 @@ >> > SItype >> > __bswapsi2 (SItype u) >> > { >> > - return u) & 0xff00) >> 24) >> > - | (((u) & 0x00ff) >> 8) >> > - | (((u) & 0xff00) << 8) >> >

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Andreas Schwab
On Nov 10 2020, Stefan Kanthak wrote: > Eric Botcazou wrote: > >>> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions >>> is rather bad, it yields bad machine code at least on i386 and AMD64. Since >>> GCC knows how to shift integers twice the register size these

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 10, 2020 at 04:48:10PM -0700, Jeff Law via Gcc-patches wrote: > > @@ -486,10 +425,10 @@ > > SItype > > __bswapsi2 (SItype u) > > { > > - return u) & 0xff00) >> 24) > > - | (((u) & 0x00ff) >> 8) > > - | (((u) & 0xff00) << 8) > > - | (((u) & 0x00ff)

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 10:59 AM, Stefan Kanthak via Gcc-patches wrote: > The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions > is rather bad, it yields bad machine code at least on i386 and AMD64. > Since GCC knows how to shift integers twice the register size these functions > can

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 2:17 PM, Jakub Jelinek wrote: > On Tue, Nov 10, 2020 at 02:09:20PM -0700, Jeff Law wrote: >> On 11/10/20 1:14 PM, Jakub Jelinek via Gcc-patches wrote: >>> On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: Eric Botcazou wrote: >> The implementation of the

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 1:14 PM, Jakub Jelinek via Gcc-patches wrote: > On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: >> Eric Botcazou wrote: >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions is rather bad, it yields bad machine code at least

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 12:44 PM, Stefan Kanthak wrote: > Eric Botcazou wrote: > >>> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions >>> is rather bad, it yields bad machine code at least on i386 and AMD64. Since >>> GCC knows how to shift integers twice the register size these

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 10, 2020 at 02:09:20PM -0700, Jeff Law wrote: > > On 11/10/20 1:14 PM, Jakub Jelinek via Gcc-patches wrote: > > On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: > >> Eric Botcazou wrote: > >> > The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() >

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 1:14 PM, Jakub Jelinek via Gcc-patches wrote: > On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: >> Eric Botcazou wrote: >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions is rather bad, it yields bad machine code at least

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 10, 2020 at 08:44:32PM +0100, Stefan Kanthak wrote: > Eric Botcazou wrote: > > >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() > >> functions > >> is rather bad, it yields bad machine code at least on i386 and AMD64. Since > >> GCC knows how to shift integers

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Stefan Kanthak
Eric Botcazou wrote: >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions >> is rather bad, it yields bad machine code at least on i386 and AMD64. Since >> GCC knows how to shift integers twice the register size these functions can >> be written as one-liners. > >

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jeff Law via Gcc-patches
On 11/10/20 11:09 AM, Jakub Jelinek via Gcc-patches wrote: > On Tue, Nov 10, 2020 at 06:59:30PM +0100, Stefan Kanthak via Gcc-patches > wrote: >> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions >> is rather bad, it yields bad machine code at least on i386 and AMD64.

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 10, 2020 at 06:59:30PM +0100, Stefan Kanthak via Gcc-patches wrote: > The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions > is rather bad, it yields bad machine code at least on i386 and AMD64. > Since GCC knows how to shift integers twice the register size

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Jakub Jelinek via Gcc-patches
On Tue, Nov 10, 2020 at 06:59:30PM +0100, Stefan Kanthak via Gcc-patches wrote: > The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions > is rather bad, it yields bad machine code at least on i386 and AMD64. > Since GCC knows how to shift integers twice the register size

Re: [PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Eric Botcazou
> The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions > is rather bad, it yields bad machine code at least on i386 and AMD64. Since > GCC knows how to shift integers twice the register size these functions can > be written as one-liners. These functions are precisely

[PATCH] Better __ashlDI3, __ashrDI3 and __lshrDI3 functions, plus fixed __bswapsi2 function

2020-11-10 Thread Stefan Kanthak via Gcc-patches
The implementation of the __ashlDI3(), __ashrDI3() and __lshrDI3() functions is rather bad, it yields bad machine code at least on i386 and AMD64. Since GCC knows how to shift integers twice the register size these functions can be written as one-liners. The implementation of the __bswapsi2()