Re: linux says it is a bug

2014-03-10 Thread lin zuojian
On Wed, Mar 05, 2014 at 10:39:51AM +0400, Yury Gribov wrote: > >What is volatile instructions? Can you give us an example? > > Check volatile_insn_p. AFAIK there are two classes of volatile instructions: > * volatile asm > * unspec volatiles (target-specific instructions for e.g. protecting > func

Re: linux says it is a bug

2014-03-05 Thread Paul_Koning
On Mar 5, 2014, at 10:07 AM, Richard Henderson wrote: > On 03/04/2014 10:12 PM, Yury Gribov wrote: Asms without outputs are automatically volatile. So there ought be zero change with and without the explicit use of the __volatile__ keyword. >>> >>> That’s what the documentation

Re: linux says it is a bug

2014-03-05 Thread Richard Henderson
On 03/04/2014 10:12 PM, Yury Gribov wrote: >>> Asms without outputs are automatically volatile. So there ought be zero >>> change >>> with and without the explicit use of the __volatile__ keyword. >> >> That’s what the documentation says but it wasn’t actually true >> as of a couple of releases a

Re: linux says it is a bug

2014-03-04 Thread Yury Gribov
What is volatile instructions? Can you give us an example? Check volatile_insn_p. AFAIK there are two classes of volatile instructions: * volatile asm * unspec volatiles (target-specific instructions for e.g. protecting function prologues) -Y

Re: linux says it is a bug

2014-03-04 Thread Yury Gribov
>> Asms without outputs are automatically volatile. So there ought be zero change >> with and without the explicit use of the __volatile__ keyword. > > That’s what the documentation says but it wasn’t actually true > as of a couple of releases ago, as I recall. Looks like 2005: $ git annotate

Re: linux says it is a bug

2014-03-04 Thread Paul_Koning
On Mar 4, 2014, at 2:30 PM, Richard Henderson wrote: > On 03/04/2014 01:23 AM, Richard Biener wrote: >> Doesn't sound like a bug but a feature. We can move >> asm ("" : : : "memory") around freely up to the next/previous >> instruction involving memory. > > Asms without outputs are automatical

Re: linux says it is a bug

2014-03-04 Thread Richard Henderson
On 03/04/2014 01:23 AM, Richard Biener wrote: > Doesn't sound like a bug but a feature. We can move > asm ("" : : : "memory") around freely up to the next/previous > instruction involving memory. Asms without outputs are automatically volatile. So there ought be zero change with and without the

Re: linux says it is a bug

2014-03-04 Thread lin zuojian
On Tue, Mar 04, 2014 at 12:08:19PM +0100, Richard Biener wrote: > On Tue, Mar 4, 2014 at 10:33 AM, Hannes Frederic Sowa > wrote: > > On Tue, Mar 04, 2014 at 09:26:31AM +, Andrew Haley wrote: > >> On 03/04/2014 09:24 AM, Hannes Frederic Sowa wrote: > >> >> > So the bug was probably fixed more t

Re: linux says it is a bug

2014-03-04 Thread Richard Biener
On Tue, Mar 4, 2014 at 1:01 PM, Hans-Peter Nilsson wrote: > On Tue, 4 Mar 2014, Yury Gribov wrote: >> Richard wrote: >> > volatile __asm__("":::"memory") >> > >> > is a memory barrier and a barrier for other volatile instructions. >> >> AFAIK asm without output arguments is implicitly marked as vo

Re: linux says it is a bug

2014-03-04 Thread Hans-Peter Nilsson
On Tue, 4 Mar 2014, Yury Gribov wrote: > Richard wrote: > > volatile __asm__("":::"memory") > > > > is a memory barrier and a barrier for other volatile instructions. > > AFAIK asm without output arguments is implicitly marked as volatile. So it may > not be needed in barrier() at all. Yes, exactl

Re: linux says it is a bug

2014-03-04 Thread Yury Gribov
Richard wrote: > volatile __asm__("":::"memory") > > is a memory barrier and a barrier for other volatile instructions. AFAIK asm without output arguments is implicitly marked as volatile. So it may not be needed in barrier() at all. -Y

Re: linux says it is a bug

2014-03-04 Thread Hannes Frederic Sowa
On Tue, Mar 04, 2014 at 12:08:19PM +0100, Richard Biener wrote: > On Tue, Mar 4, 2014 at 10:33 AM, Hannes Frederic Sowa > wrote: > > On Tue, Mar 04, 2014 at 09:26:31AM +, Andrew Haley wrote: > >> On 03/04/2014 09:24 AM, Hannes Frederic Sowa wrote: > >> >> > So the bug was probably fixed more t

Re: linux says it is a bug

2014-03-04 Thread Richard Biener
On Tue, Mar 4, 2014 at 10:33 AM, Hannes Frederic Sowa wrote: > On Tue, Mar 04, 2014 at 09:26:31AM +, Andrew Haley wrote: >> On 03/04/2014 09:24 AM, Hannes Frederic Sowa wrote: >> >> > So the bug was probably fixed more than 15 years ago. >> > Probably :) >> > >> > But the __volatile__ shoud do

Re: linux says it is a bug

2014-03-04 Thread Hannes Frederic Sowa
On Tue, Mar 04, 2014 at 09:26:31AM +, Andrew Haley wrote: > On 03/04/2014 09:24 AM, Hannes Frederic Sowa wrote: > >> > So the bug was probably fixed more than 15 years ago. > > Probably :) > > > > But the __volatile__ shoud do no harm and shouldn't influence code > > generation in any way, no?

Re: linux says it is a bug

2014-03-04 Thread Andrew Haley
On 03/04/2014 09:24 AM, Hannes Frederic Sowa wrote: >> > So the bug was probably fixed more than 15 years ago. > Probably :) > > But the __volatile__ shoud do no harm and shouldn't influence code > generation in any way, no? Of course it will: it's a barrier. Andrew.

Re: linux says it is a bug

2014-03-04 Thread Hannes Frederic Sowa
On Tue, Mar 04, 2014 at 09:19:40AM +, Jonathan Wakely wrote: > On 4 March 2014 09:17, Hannes Frederic Sowa > wrote: > > On Tue, Mar 04, 2014 at 10:10:21AM +0100, Richard Biener wrote: > >> On Tue, Mar 4, 2014 at 7:40 AM, lin zuojian wrote: > >> > Hi, > >> > in include/linux/compiler-gcc.

Re: linux says it is a bug

2014-03-04 Thread Richard Biener
On Tue, Mar 4, 2014 at 10:19 AM, Jonathan Wakely wrote: > On 4 March 2014 09:17, Hannes Frederic Sowa > wrote: >> On Tue, Mar 04, 2014 at 10:10:21AM +0100, Richard Biener wrote: >>> On Tue, Mar 4, 2014 at 7:40 AM, lin zuojian wrote: >>> > Hi, >>> > in include/linux/compiler-gcc.h : >>> > >>

Re: linux says it is a bug

2014-03-04 Thread Jonathan Wakely
On 4 March 2014 09:17, Hannes Frederic Sowa wrote: > On Tue, Mar 04, 2014 at 10:10:21AM +0100, Richard Biener wrote: >> On Tue, Mar 4, 2014 at 7:40 AM, lin zuojian wrote: >> > Hi, >> > in include/linux/compiler-gcc.h : >> > >> > /* Optimization barrier */ >> > /* The "volatile" is due to gcc

Re: linux says it is a bug

2014-03-04 Thread Hannes Frederic Sowa
On Tue, Mar 04, 2014 at 10:10:21AM +0100, Richard Biener wrote: > On Tue, Mar 4, 2014 at 7:40 AM, lin zuojian wrote: > > Hi, > > in include/linux/compiler-gcc.h : > > > > /* Optimization barrier */ > > /* The "volatile" is due to gcc bugs */ > > #define barrier() __asm__ __volatile__("": : :"m

Re: linux says it is a bug

2014-03-04 Thread Richard Biener
On Tue, Mar 4, 2014 at 7:40 AM, lin zuojian wrote: > Hi, > in include/linux/compiler-gcc.h : > > /* Optimization barrier */ > /* The "volatile" is due to gcc bugs */ > #define barrier() __asm__ __volatile__("": : :"memory") > > The comment of Linux says this is a gcc bug.But will any sane comp

linux says it is a bug

2014-03-03 Thread lin zuojian
Hi, in include/linux/compiler-gcc.h : /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") The comment of Linux says this is a gcc bug.But will any sane compiler disable optimization without "volatile" key word? -- Reg