Re: Request for discussion: Rewrite of inline assembler docs

2014-04-01 Thread dw
On 3/31/2014 1:41 AM, Andrew Haley wrote: On 03/31/2014 05:44 AM, dw wrote: So, after looking over this discussion, I have updated the text. This time no undefined terms, while still conveying all the points I had in mind: The "memory" clobber tells the compiler that the assembly code performs

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-31 Thread Andrew Haley
On 03/31/2014 05:44 AM, dw wrote: > So, after looking over this discussion, I have updated the text. This > time no undefined terms, while still conveying all the points I had in mind: > > The "memory" clobber tells the compiler that the assembly code performs > memory reads or writes to items o

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-30 Thread dw
So, after looking over this discussion, I have updated the text. This time no undefined terms, while still conveying all the points I had in mind: The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and ou

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Andrew Haley
On 03/28/2014 02:48 PM, Hannes Frederic Sowa wrote: > On Fri, Mar 28, 2014 at 01:15:39PM +, Andrew Haley wrote: >> On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote: >>> On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley wrote: On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: >

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Hannes Frederic Sowa
On Fri, Mar 28, 2014 at 01:15:39PM +, Andrew Haley wrote: > On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote: > > On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley wrote: > >> On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: > >>> On Fri, Mar 28, 2014 at 09:10:11AM +, Andrew Haley

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Hannes Frederic Sowa
On Fri, Mar 28, 2014 at 03:03:11PM +, Andrew Haley wrote: > On 03/28/2014 02:48 PM, Hannes Frederic Sowa wrote: > > On Fri, Mar 28, 2014 at 01:15:39PM +, Andrew Haley wrote: > >> On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote: > >>> On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Andrew Haley
On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote: > On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley wrote: >> On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: >>> On Fri, Mar 28, 2014 at 09:10:11AM +, Andrew Haley wrote: On 03/28/2014 06:20 AM, dw wrote: > Using this clobbe

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread shmeel gutl
On 28-Mar-14 01:46 PM, Hannes Frederic Sowa wrote: On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley wrote: Ok, I see the problem. Maybe something like this by avoiding the term? Using this clobber causes the compiler to flush all (modified) registers being used to store values which gcc d

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Hannes Frederic Sowa
On Fri, Mar 28, 2014 at 09:41:41AM +, Andrew Haley wrote: > On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: > > On Fri, Mar 28, 2014 at 09:10:11AM +, Andrew Haley wrote: > >> On 03/28/2014 06:20 AM, dw wrote: > >>> Using this clobber causes the compiler to flush all (modified) registers

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Andrew Haley
On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: > On Fri, Mar 28, 2014 at 09:10:11AM +, Andrew Haley wrote: >> On 03/28/2014 06:20 AM, dw wrote: >>> Using this clobber causes the compiler to flush all (modified) registers >>> being used to store memory-based values to memory before executi

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Hannes Frederic Sowa
On Fri, Mar 28, 2014 at 09:10:11AM +, Andrew Haley wrote: > On 03/28/2014 06:20 AM, dw wrote: > > Using this clobber causes the compiler to flush all (modified) registers > > being used to store memory-based values to memory before executing the > > @code{asm} statement. > > I don't know wha

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Andrew Haley
On 03/28/2014 06:20 AM, dw wrote: > Using this clobber causes the compiler to flush all (modified) registers > being used to store memory-based values to memory before executing the > @code{asm} statement. I don't know what a "memory-based" value is. This phrase doesn't help at all. In additio

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-28 Thread Richard Sandiford
dw writes: > Using this clobber causes the compiler to flush all (modified) registers > being used to store memory-based values to memory before executing the > @code{asm} statement. Further, the compiler will not assume that any > memory-based values read before the @code{asm} will remain unc

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-27 Thread dw
Looks great to me. Just noticed one small nit: in the extended asm section, "=irm" isn't valid, since you can't assign to an immediate. Doh! I probably copied this from the Input section. Good catch. Also, in the section about clobbers: It causes the compiler to flush all registers to

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-27 Thread Richard Sandiford
dw writes: >> I think it really is general though. In: >>> The same problem can occur if one output parameter (@var{a}) allows a >>> register constraint, is updating the parameter value, and references an >>> address while another output parameter (@var{b}) allows a memory >>> constraint. > > Yep,

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-26 Thread dw
I think it really is general though. In: The same problem can occur if one output parameter (@var{a}) allows a register constraint, is updating the parameter value, and references an address while another output parameter (@var{b}) allows a memory constraint. Yep, you're right. I have trimme

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-26 Thread Richard Sandiford
dw writes: > On 3/25/2014 4:20 AM, Richard Sandiford wrote: >> dw writes: asm ("" : "=m" (*x), "=r" (y)); you have to assume that the address in %0 might use the same register as %1 >>> Ok, now I'm getting there. It helps that I've compiled some examples >>> and can see what i

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-26 Thread dw
On 3/25/2014 4:20 AM, Richard Sandiford wrote: dw writes: asm ("" : "=m" (*x), "=r" (y)); you have to assume that the address in %0 might use the same register as %1 Ok, now I'm getting there. It helps that I've compiled some examples and can see what is happening. This one is subtle.

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-25 Thread Richard Sandiford
dw writes: >>asm ("" : "=m" (*x), "=r" (y)); >> >> you have to assume that the address in %0 might use the same register as %1 > > Ok, now I'm getting there. It helps that I've compiled some examples > and can see what is happening. This one is subtle. I'm going to have > to go back and r

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-24 Thread dw
Sorry for the slow response. Thanks for getting back to me. I was pretty sure I didn't have this all quite right yet. asm ("" : "=m" (*x), "=r" (y)); you have to assume that the address in %0 might use the same register as %1 Ok, now I'm getting there. It helps that I've compiled s

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-22 Thread Richard Sandiford
Sorry for the slow response. dw writes: > On 3/3/2014 3:36 AM, Richard Sandiford wrote: >> Well, like you say, things can be moved across branches. So, although >> this is a very artificial example: >> >> asm ("x"); >> asm ("y"); >> >> could become: >> >> goto bar; >> >> foo: >

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-22 Thread dw
On 3/21/2014 2:57 AM, James Greenhalgh wrote: On Thu, Feb 27, 2014 at 11:07:21AM +, Andrew Haley wrote: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-21 Thread James Greenhalgh
On Thu, Feb 27, 2014 at 11:07:21AM +, Andrew Haley wrote: > Over the years there has been a great deal of traffic on these lists > caused by misunderstandings of GCC's inline assembler. That's partly > because it's inherently tricky, but the existing documentation needs > to be improved. > >

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-05 Thread dw
On 3/3/2014 3:36 AM, Richard Sandiford wrote: dw writes: On 2/27/2014 11:32 PM, Richard Sandiford wrote: dw writes: On 2/27/2014 4:11 AM, Richard Sandiford wrote: Andrew Haley writes: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC'

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-03 Thread Richard Sandiford
dw writes: > On 2/27/2014 11:32 PM, Richard Sandiford wrote: >> dw writes: >>> On 2/27/2014 4:11 AM, Richard Sandiford wrote: Andrew Haley writes: > Over the years there has been a great deal of traffic on these lists > caused by misunderstandings of GCC's inline assembler. That's

Re: Request for discussion: Rewrite of inline assembler docs

2014-03-03 Thread dw
On 2/27/2014 8:12 PM, Andi Kleen wrote: dw writes: What would you say to something like this: "Since GCC does not parse the asm, it has no visibility of any static variables or functions it references. This may result in those symbols getting discarded by GCC as unused. To avoid this proble

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Richard Sandiford
dw writes: > On 2/27/2014 4:11 AM, Richard Sandiford wrote: >> Andrew Haley writes: >>> Over the years there has been a great deal of traffic on these lists >>> caused by misunderstandings of GCC's inline assembler. That's partly >>> because it's inherently tricky, but the existing documentation

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Andi Kleen
dw writes: > > What would you say to something like this: > > "Since GCC does not parse the asm, it has no visibility of any static > variables or functions it references. This may result in those > symbols getting discarded by GCC as unused. To avoid this problem, > list the symbols as inputs o

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread dw
On 2/27/2014 9:35 AM, Andi Kleen wrote: Andrew Haley writes: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing documentation needs to be improved. dw has

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread dw
On 2/27/2014 4:22 AM, Kyrill Tkachov wrote: On 27/02/14 11:07, Andrew Haley wrote: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing documentation needs to b

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread dw
On 2/27/2014 4:11 AM, Richard Sandiford wrote: Andrew Haley writes: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing documentation needs to be improved. d

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Andi Kleen
Andrew Haley writes: > Over the years there has been a great deal of traffic on these lists > caused by misunderstandings of GCC's inline assembler. That's partly > because it's inherently tricky, but the existing documentation needs > to be improved. > > dw has done a fairly thorough reworking

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Kyrill Tkachov
On 27/02/14 11:07, Andrew Haley wrote: Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing documentation needs to be improved. dw has done a fairly thorough re

Re: Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Richard Sandiford
Andrew Haley writes: > Over the years there has been a great deal of traffic on these lists > caused by misunderstandings of GCC's inline assembler. That's partly > because it's inherently tricky, but the existing documentation needs > to be improved. > > dw has done a fairly thorough reworking

Request for discussion: Rewrite of inline assembler docs

2014-02-27 Thread Andrew Haley
Over the years there has been a great deal of traffic on these lists caused by misunderstandings of GCC's inline assembler. That's partly because it's inherently tricky, but the existing documentation needs to be improved. dw has done a fairly thorough reworking of the documentation. I've helpe