Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-10-01 Thread Paolo Bonzini
Il 03/08/2012 17:08, Richard Henderson ha scritto: > On 2012-08-03 08:01, Uros Bizjak wrote: >> On Fri, Aug 3, 2012 at 4:40 PM, Richard Henderson wrote: >>> On 2012-08-03 01:51, Uros Bizjak wrote: The same reasoning goes for dynamic negation: for neg %eax,%eax value 0x8000 stays the

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-10-01 Thread Andrew MacLeod
On 08/30/2012 05:33 PM, Richard Henderson wrote: On 08/23/2012 08:59 AM, Andrew MacLeod wrote: 2012-08-23 Andrew MacLeod gcc PR target/54087 * optabs.c (expand_atomic_fetch_op_no_fallback): New. Factored code from expand_atomic_fetch_op. (expand_atomic_fetch_

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-30 Thread Richard Henderson
On 08/23/2012 08:59 AM, Andrew MacLeod wrote: > 2012-08-23 Andrew MacLeod > > gcc > PR target/54087 > * optabs.c (expand_atomic_fetch_op_no_fallback): New. Factored code > from expand_atomic_fetch_op. > (expand_atomic_fetch_op): iTry atomic_{add|sub} operations in term

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-23 Thread Andrew MacLeod
On 08/03/2012 02:52 PM, Andrew MacLeod wrote: I'll take a look at it next week unless someone gets to it first. Andrew OK, so maybe I sort of forgot about implementing the generic transformation until now. This patch bootstraps and passes all the testsuite cases. Factored out a little co

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Andrew MacLeod
On 08/03/2012 02:14 PM, Uros Bizjak wrote: On Fri, Aug 3, 2012 at 8:11 PM, Richard Henderson wrote: On 2012-08-03 11:02, Uros Bizjak wrote: Nice, so we can go with full [snip] Unless we take Andrew's suggestion to simply do this in optabs.c instead. Which is probably better. Indeed. However,

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Uros Bizjak
On Fri, Aug 3, 2012 at 8:11 PM, Richard Henderson wrote: > On 2012-08-03 11:02, Uros Bizjak wrote: >> Nice, so we can go with full [snip] > > Unless we take Andrew's suggestion to simply do this in optabs.c instead. > Which is probably better. Indeed. However, I'm not that familiar with this part

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Richard Henderson
On 2012-08-03 11:02, Uros Bizjak wrote: > Nice, so we can go with full [snip] Unless we take Andrew's suggestion to simply do this in optabs.c instead. Which is probably better. r~

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Uros Bizjak
On Fri, Aug 3, 2012 at 5:08 PM, Richard Henderson wrote: The same reasoning goes for dynamic negation: for neg %eax,%eax value 0x8000 stays the same, but we have changed (x)sub to an (x)add in the code stream. >>> >>> So? Did you think the xadd will trap? >> >> No, but can we

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Richard Henderson
On 2012-08-03 08:01, Uros Bizjak wrote: > On Fri, Aug 3, 2012 at 4:40 PM, Richard Henderson wrote: >> On 2012-08-03 01:51, Uros Bizjak wrote: >>> The same reasoning goes for dynamic negation: for neg %eax,%eax value >>> 0x8000 stays the same, but we have changed (x)sub to an (x)add in >>> the

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Andrew MacLeod
On 08/03/2012 10:40 AM, Richard Henderson wrote: On 2012-08-03 01:51, Uros Bizjak wrote: The same reasoning goes for dynamic negation: for neg %eax,%eax value 0x8000 stays the same, but we have changed (x)sub to an (x)add in the code stream. So? Did you think the xadd will trap? Is there

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Uros Bizjak
On Fri, Aug 3, 2012 at 4:40 PM, Richard Henderson wrote: > On 2012-08-03 01:51, Uros Bizjak wrote: >> The same reasoning goes for dynamic negation: for neg %eax,%eax value >> 0x8000 stays the same, but we have changed (x)sub to an (x)add in >> the code stream. > > So? Did you think the xadd w

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Richard Henderson
On 2012-08-03 01:51, Uros Bizjak wrote: > The same reasoning goes for dynamic negation: for neg %eax,%eax value > 0x8000 stays the same, but we have changed (x)sub to an (x)add in > the code stream. So? Did you think the xadd will trap? r~

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Uros Bizjak
On Fri, Aug 3, 2012 at 10:02 AM, Richard Guenther wrote: > On Fri, Aug 3, 2012 at 9:24 AM, Uros Bizjak wrote: >> On Fri, Aug 3, 2012 at 8:40 AM, Uros Bizjak wrote: >> >>> We can implement atomic_fetch_sub with atomic_fetch_add and inverted >>> operand 2. However, we have to prevent overflows wit

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Richard Guenther
On Fri, Aug 3, 2012 at 9:24 AM, Uros Bizjak wrote: > On Fri, Aug 3, 2012 at 8:40 AM, Uros Bizjak wrote: > >> We can implement atomic_fetch_sub with atomic_fetch_add and inverted >> operand 2. However, we have to prevent overflows with negation, so >> only const_int operand 2 is allowed in the exp

Re: [PATCH, i386]: Implement atomic_fetch_sub

2012-08-03 Thread Uros Bizjak
On Fri, Aug 3, 2012 at 8:40 AM, Uros Bizjak wrote: > We can implement atomic_fetch_sub with atomic_fetch_add and inverted > operand 2. However, we have to prevent overflows with negation, so > only const_int operand 2 is allowed in the expander. > > 2012-08-02 Uros Bizjak > > PR target

[PATCH, i386]: Implement atomic_fetch_sub

2012-08-02 Thread Uros Bizjak
Hello! We can implement atomic_fetch_sub with atomic_fetch_add and inverted operand 2. However, we have to prevent overflows with negation, so only const_int operand 2 is allowed in the expander. 2012-08-02 Uros Bizjak PR target/54087 * config/i386/sync.md (atomic_fetch_sub):