Re: [PING v2][PATCH][4.9] Backport fix for PR sanitizer/64820.

2015-12-01 Thread Joakim Tjernlund
On Tue, 2015-12-01 at 20:23 +0300, Maxim Ostapenko wrote: > On 25/11/15 12:14, Maxim Ostapenko wrote: > > I would like to ping the patch: > > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02174.html. > > > > Ping. Yes, please add :)

PowerPC optimization regression

2010-12-08 Thread Joakim Tjernlund
I have noticed gcc 4.4.5 often produces less optimzed code than the old 3.4.6. Below is the latest example. I am starting to wonder if I need rebuild gcc 4.4.5 and/or add new options to gcc when I compile. Any insight? Jocke const char *test(int i) { const char *p = abc\0def\0gef;

Re: PowerPC optimization regression

2010-12-08 Thread Joakim Tjernlund
David Edelsohn dje@gmail.com wrote on 2010/12/08 17:38:11: On Wed, Dec 8, 2010 at 4:37 AM, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: I have noticed gcc 4.4.5 often produces less optimzed code than the old 3.4.6. Below is the latest example. I am starting to wonder if I

Re: ppc: const data not in RO section

2010-12-01 Thread Joakim Tjernlund
Nathan Froyd froy...@codesourcery.com wrote on 2010/12/01 18:33:23: On Tue, Nov 30, 2010 at 08:04:06PM +0100, Joakim Tjernlund wrote: Why is not const char cstr[] = mystr; const int myint = 3; added to a read only section? Especially since const int myarr[]={1,2,3}; is placed

Re: ppc: const data not in RO section

2010-12-01 Thread Joakim Tjernlund
Nathan Froyd froy...@codesourcery.com wrote on 2010/12/01 18:33:23: On Tue, Nov 30, 2010 at 08:04:06PM +0100, Joakim Tjernlund wrote: Why is not const char cstr[] = mystr; const int myint = 3; added to a read only section? Especially since const int myarr[]={1,2,3}; is placed

const char wd[6] = Wednes, is that legal?

2010-11-30 Thread Joakim Tjernlund
gcc 4.4.5, powerpc32 does not fail const char wd[6] = Wednes; even though wd only has room for 6 chars. Is this intended? Jocke

ppc: const data not in RO section

2010-11-30 Thread Joakim Tjernlund
Why is not const char cstr[] = mystr; const int myint = 3; added to a read only section? Especially since const int myarr[]={1,2,3}; is placed in .rodata. hmm, -G 0 does place these in .rodata but why do I have to specify that?

Re: %pc relative addressing of string literals/const data

2010-11-08 Thread Joakim Tjernlund
Dave Korn dave.korn.cyg...@gmail.com wrote on 2010/10/27 13:59:00: On 27/10/2010 07:47, Joakim Tjernlund wrote: Alan Modra amo...@gmail.com wrote on 2010/10/27 04:01:50: On Wed, Oct 27, 2010 at 12:53:00AM +0100, Dave Korn wrote: On 26/10/2010 23:37, Joakim Tjernlund wrote: Everything

powerpc: What happened to lwzu/stwu in loops?

2010-11-03 Thread Joakim Tjernlund
Using gcc 4.4.4 -Os on loop(long *to, long *from, long len) { for (; len; --len) *++to = *++from; } I get /* gcc 4.4.4 -Os loop: addi 5,5,1 li 9,0 mtctr 5 b .L2 .L3: lwzx 0,4,9 stwx 0,3,9 .L2: addi 9,9,4 bdnz

Re: powerpc: What happened to lwzu/stwu in loops?

2010-11-03 Thread Joakim Tjernlund
Andrew Pinski pins...@gmail.com wrote on 2010/11/03 17:44:17: On Wed, Nov 3, 2010 at 9:02 AM, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: Using gcc 4.4.4 -Os on You might want to try 4.5.0 which IIRC has a fix for this issue. The issue is IV-OPTs does not take into account

Re: %pc relative addressing of string literals/const data

2010-10-27 Thread Joakim Tjernlund
Alan Modra amo...@gmail.com wrote on 2010/10/27 04:01:50: On Wed, Oct 27, 2010 at 12:53:00AM +0100, Dave Korn wrote: On 26/10/2010 23:37, Joakim Tjernlund wrote: Everything went dead quiet the minute I stated to send patches, what did I do wrong? Nothing, you just ran

Re: %pc relative addressing of string literals/const data

2010-10-26 Thread Joakim Tjernlund
Joakim Tjernlund/Transmode wrote on 2010/10/14 15:54:32: Joakim Tjernlund/Transmode wrote on 2010/10/12 11:00:36: Alan Modra amo...@gmail.com wrote on 2010/10/11 14:58:45: On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote: Now I have had a closer look

Re: %pc relative addressing of string literals/const data

2010-10-14 Thread Joakim Tjernlund
Joakim Tjernlund/Transmode wrote on 2010/10/12 11:00:36: Alan Modra amo...@gmail.com wrote on 2010/10/11 14:58:45: On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote: Now I have had a closer look at this and it looks much like -fpic on ppc32, you still use the GOT/TOC

Re: %pc relative addressing of string literals/const data

2010-10-12 Thread Joakim Tjernlund
Alan Modra amo...@gmail.com wrote on 2010/10/11 14:58:45: On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote: Now I have had a closer look at this and it looks much like -fpic on ppc32, you still use the GOT/TOC to load the address where the data is. No, with ppc64 -mcmodel

Re: %pc relative addressing of string literals/const data

2010-10-12 Thread Joakim Tjernlund
Joakim Tjernlund/Transmode wrote on 2010/10/09 18:32:40: Michael Meissner meiss...@linux.vnet.ibm.com wrote on 2010/10/07 20:21:38: On Thu, Oct 07, 2010 at 04:50:50PM +0200, Joakim Tjernlund wrote: Why not offer some of this on PowerPC32? mcmodel=small would probably be enough

Re: %pc relative addressing of string literals/const data

2010-10-11 Thread Joakim Tjernlund
Alan Modra amo...@gmail.com wrote on 2010/10/11 14:58:45: On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote: Now I have had a closer look at this and it looks much like -fpic on ppc32, you still use the GOT/TOC to load the address where the data is. No, with ppc64 -mcmodel

Re: %pc relative addressing of string literals/const data

2010-10-10 Thread Joakim Tjernlund
Alan Modra amo...@gmail.com wrote on 2010/10/06 00:19:26: On Tue, Oct 05, 2010 at 11:40:11PM +0200, Joakim Tjernlund wrote: yes, but this could be a new PIC mode that uses a new better PIC mode for everything. Especially one that doesn't require each function to calculate the GOT address

Re: %pc relative addressing of string literals/const data

2010-10-09 Thread Joakim Tjernlund
Michael Meissner meiss...@linux.vnet.ibm.com wrote on 2010/10/07 20:21:38: On Thu, Oct 07, 2010 at 04:50:50PM +0200, Joakim Tjernlund wrote: Why not offer some of this on PowerPC32? mcmodel=small would probably be enough. Well as they say, contributions are welcome. Note, 32-bit mode

Re: %pc relative addressing of string literals/const data

2010-10-07 Thread Joakim Tjernlund
Richard Henderson r...@redhat.com wrote on 2010/10/06 00:13:22: On 10/05/2010 02:40 PM, Joakim Tjernlund wrote: Especially one that doesn't require each function to calculate the GOT address in the function prologue(why is that so?) Because PIC code can be called from non-PIC code

Re: %pc relative addressing of string literals/const data

2010-10-07 Thread Joakim Tjernlund
Michael Meissner meiss...@linux.vnet.ibm.com wrote on 2010/10/07 15:00:25: On Tue, Oct 05, 2010 at 11:56:55AM -0700, Richard Henderson wrote: On 10/05/2010 06:54 AM, Joakim Tjernlund wrote: Ian Lance Taylor i...@google.com wrote on 2010/10/05 15:47:38: Joakim Tjernlund joakim.tjernl

Re: %pc relative addressing of string literals/const data

2010-10-07 Thread Joakim Tjernlund
Michael Meissner meiss...@linux.vnet.ibm.com wrote on 2010/10/07 20:21:38: On Thu, Oct 07, 2010 at 04:50:50PM +0200, Joakim Tjernlund wrote: Why not offer some of this on PowerPC32? mcmodel=small would probably be enough. Well as they say, contributions are welcome. Note, 32-bit mode

Re: %pc relative addressing of string literals/const data

2010-10-06 Thread Joakim Tjernlund
Alan Modra amo...@gmail.com wrote on 2010/10/06 00:19:26: On Tue, Oct 05, 2010 at 11:40:11PM +0200, Joakim Tjernlund wrote: yes, but this could be a new PIC mode that uses a new better PIC mode for everything. Especially one that doesn't require each function to calculate the GOT address

Re: %pc relative addressing of string literals/const data

2010-10-06 Thread Joakim Tjernlund
Gabriel Paubert paub...@iram.es wrote on 2010/10/06 10:15:26: On Tue, Oct 05, 2010 at 10:55:36PM +0200, Joakim Tjernlund wrote: Richard Henderson r...@redhat.com wrote on 2010/10/05 20:56:55: On 10/05/2010 06:54 AM, Joakim Tjernlund wrote: Ian Lance Taylor i...@google.com wrote

%pc relative addressing of string literals/const data

2010-10-05 Thread Joakim Tjernlund
While doing relocation work on u-boot I often whish for strings/const data to be accessible through %pc relative address rather than and ABS address or through GOT. Has this feature ever been considered by gcc? Jocke

Re: %pc relative addressing of string literals/const data

2010-10-05 Thread Joakim Tjernlund
Ian Lance Taylor i...@google.com wrote on 2010/10/05 15:47:38: Joakim Tjernlund joakim.tjernl...@transmode.se writes: While doing relocation work on u-boot I often whish for strings/const data to be accessible through %pc relative address rather than and ABS address or through GOT. Has

Re: %pc relative addressing of string literals/const data

2010-10-05 Thread Joakim Tjernlund
Richard Henderson r...@redhat.com wrote on 2010/10/05 23:12:19: On 10/05/2010 01:55 PM, Joakim Tjernlund wrote: I don't do x86 or alpha so let me ask: If you run the code on an address != link address, will it do the right thing? Yes of course. It wouldn't be -fpic code otherwise. Just

memcpy(p,p,len)

2010-04-30 Thread Joakim Tjernlund
Is memcpy supposed to work when the src and dest are the same: memcpy(p, p, 100); Jocke

Re: memcpy(p,p,len)

2010-04-30 Thread Joakim Tjernlund
Jan-Benedict Glaw jbg...@lug-owl.de wrote on 2010/04/30 16:10:42: On Fri, 2010-04-30 16:08:15 +0200, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: Is memcpy supposed to work when the src and dest are the same: memcpy(p, p, 100); It may work, but you cannot rely on it. Use memmove

Re: PowerPC suboptimal add with carry optimization

2010-04-26 Thread Joakim Tjernlund
Ian Lance Taylor i...@google.com wrote on 2010/04/25 20:07:03: Joakim Tjernlund joakim.tjernl...@transmode.se writes: Noticed that gcc 4.3.4 doesn't optimize add with carry properly: Please file a missed-optimization report according to http://gcc.gnu.org/bugs/ . Thanks. I rather

Re: PowerPC suboptimal add with carry optimization

2010-04-26 Thread Joakim Tjernlund
Ian Lance Taylor i...@google.com wrote on 2010/04/25 20:07:03: Joakim Tjernlund joakim.tjernl...@transmode.se writes: Noticed that gcc 4.3.4 doesn't optimize add with carry properly: BTW, I can see in gcc src: (define_insn [(set (match_operand:CC 0 cc_reg_operand =x,?y

Re: PowerPC suboptimal add with carry optimization

2010-04-26 Thread Joakim Tjernlund
Manuel López-Ibáñez lopeziba...@gmail.com wrote on 2010/04/26 13:59:04: On 26 April 2010 09:13, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: Ian Lance Taylor i...@google.com wrote on 2010/04/25 20:07:03: Joakim Tjernlund joakim.tjernl...@transmode.se writes: Noticed that gcc

Re: PowerPC suboptimal add with carry optimization

2010-04-26 Thread Joakim Tjernlund
David Edelsohn dje@gmail.com wrote on 2010/04/26 14:54:55: On Mon, Apr 26, 2010 at 8:21 AM, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: Manuel López-Ibáñez lopeziba...@gmail.com wrote on 2010/04/26 13:59:04: On 26 April 2010 09:13, Joakim Tjernlund joakim.tjernl

Re: PowerPC suboptimal add with carry optimization

2010-04-26 Thread Joakim Tjernlund
Manuel López-Ibáñez lopeziba...@gmail.com wrote on 2010/04/26 15:29:54: On 26 April 2010 15:22, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: feature enhancement.  Some of the information can be left blank, but if we do not have information about the system and an example, we may

PowerPC suboptimal add with carry optimization

2010-04-25 Thread Joakim Tjernlund
Noticed that gcc 4.3.4 doesn't optimize add with carry properly: static u32 add32carry(u32 sum, u32 x) { u32 z = sum + x; if (sum + x x) z++; return z; } Becomes: add32carry: add 3,3,4 subfc 0,4,3 subfe 0,0,0 subfc 0,0,3 mr 3,0 Instead of:

gcc -O1 performs better than gcc -O2

2010-02-14 Thread Joakim Tjernlund
Noticed while optimizing crc16 that gcc -O performed much better than gcc -O2 while doing crc16: # gcc -O1 CRC16.c ;./a.out crc1:f532 crc2:f532 crc16 tv_res:0 :12768 CRC16 tv_res:0 :10795 # gcc -O2 CRC16.c ;./a.out crc1:f532 crc2:f532 crc16 tv_res:0 :17092 CRC16 tv_res:0 :11581 # gcc

Re: gcc -O1 performs better than gcc -O2

2010-02-14 Thread Joakim Tjernlund
Richard Guenther richard.guent...@gmail.com wrote on 2010/02/14 19:05:24: On Sun, Feb 14, 2010 at 5:51 PM, Joakim Tjernlund joakim.tjernl...@transmode.se wrote: Noticed while optimizing crc16 that gcc -O performed much better than gcc -O2 while doing crc16: Reducing the noise by adding

Re: gcc -O1 performs better than gcc -O2

2010-02-14 Thread Joakim Tjernlund
Jakub Jelinek ja...@redhat.com wrote on 2010/02/14 20:21:50: On Sun, Feb 14, 2010 at 08:06:20PM +0100, Joakim Tjernlund wrote: the warmup isn't really needed after I added memset and inline or not should not matter that much are only used once so I think my conclusion still stands: gcc