Re: [PATCH] PR 50123 - Use exchange for atomic fetch_and and fetch_or when possible.

2011-11-29 Thread Richard Henderson
On 11/29/2011 07:08 AM, Andrew MacLeod wrote: > PR target/50123 > * optabs.c (maybe_optimize_fetch_op): New. Look for more optimal > instructions for a FECTH_OP or OP_FECTH sequence. > (expand_atomic_fetch_op): Call maybe_optimize_fetch_op. > * testsuite/gcc.dg/atomic

[PATCH] PR 50123 - Use exchange for atomic fetch_and and fetch_or when possible.

2011-11-29 Thread Andrew MacLeod
The bug observes that atomic and/or operations can occasionally be replaced with a exchange operation. fetch_and (&x, 0) -> exchange (&x, 0) fetch_or (&x, -1)-> exchange (&x, -1) This is now trivial in the general expansion code. Others could easily be added later. This pat