Re: __builtin_memcpy and alignment assumptions

2016-01-11 Thread Richard Biener
On Fri, Jan 8, 2016 at 7:36 PM, Steve Ellcey wrote: > On Fri, 2016-01-08 at 12:56 +0100, Richard Biener wrote: >> On Fri, Jan 8, 2016 at 12:40 PM, Eric Botcazou >> wrote: >> >> I think we only assume it if the pointer is actually dereferenced, >> >> otherwise >> >> it just breaks too much code

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Steve Ellcey
On Fri, 2016-01-08 at 12:56 +0100, Richard Biener wrote: > On Fri, Jan 8, 2016 at 12:40 PM, Eric Botcazou > wrote: > >> I think we only assume it if the pointer is actually dereferenced, > >> otherwise > >> it just breaks too much code in the wild. And while memcpy dereferences, > >> it derefer

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Jakub Jelinek
On Fri, Jan 08, 2016 at 03:28:53PM +, paul_kon...@dell.com wrote: > If it really is necessary to say that memcpy is defined to behave as if it > had a cast to char* in its implementation, it would still be useful -- and > obviously valid -- to rely on the greater alignment when there is other

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Paul_Koning
> On Jan 8, 2016, at 6:32 AM, Jakub Jelinek wrote: > > On Fri, Jan 08, 2016 at 12:24:49PM +0100, Eric Botcazou wrote: >>> See some existing PR. The GCC middle-end cannot assume that pointers >>> are aligned according to their type (while at least the C language would >>> support that notion). >

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Richard Biener
On Fri, Jan 8, 2016 at 12:40 PM, Eric Botcazou wrote: >> I think we only assume it if the pointer is actually dereferenced, otherwise >> it just breaks too much code in the wild. And while memcpy dereferences, >> it dereferences it through a char * cast, and thus only the minimum >> alignment is

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Eric Botcazou
> I think we only assume it if the pointer is actually dereferenced, otherwise > it just breaks too much code in the wild. And while memcpy dereferences, > it dereferences it through a char * cast, and thus only the minimum > alignment is assumed. Yet the compiler was generating the expected code

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Richard Biener
On Fri, Jan 8, 2016 at 12:24 PM, Eric Botcazou wrote: >> See some existing PR. The GCC middle-end cannot assume that pointers >> are aligned according to their type (while at least the C language would >> support that notion). > > Only on x86. It could (and used to) do it on strict-alignment arc

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Jakub Jelinek
On Fri, Jan 08, 2016 at 12:24:49PM +0100, Eric Botcazou wrote: > > See some existing PR. The GCC middle-end cannot assume that pointers > > are aligned according to their type (while at least the C language would > > support that notion). > > Only on x86. It could (and used to) do it on strict-a

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Eric Botcazou
> See some existing PR. The GCC middle-end cannot assume that pointers > are aligned according to their type (while at least the C language would > support that notion). Only on x86. It could (and used to) do it on strict-alignment architectures. -- Eric Botcazou

Re: __builtin_memcpy and alignment assumptions

2016-01-08 Thread Richard Biener
On Thu, Jan 7, 2016 at 9:05 PM, Steve Ellcey wrote: > I have a question about __builtin_memcpy and alignment. While working on > MIPS I noticed that this program: > > void foo(int *a, int *b) > { > __builtin_memcpy (a, b, 8); > } > > Is generating the following MIPS code (allowing for any