On 9/21/19 12:27 PM, Paul Koning wrote: > > >> On Sep 20, 2019, at 9:18 PM, co...@sdf.org wrote: >> >> On Fri, Sep 20, 2019 at 10:07:59PM +0000, co...@sdf.org wrote: >>> Introducing the reversed jbb* patterns doesn't seem to help with the >>> original issue. It crashes building libatomic. >> >> My loose understanding of what is going on: >> - GCC emits this atomic in expand. >> - When cleaning up, it looks for optimizations. >> - It decides this is a branch to another branch situation, so maybe >> can be improved. >> - This fails to output an instruction for unrelated reasons. >> - Hit an assert. >> >> I don't think that we should be trying to combine regular branch + >> atomic branch in very generic code. >> My guess is that, if it didn't crash now, it might emit a different kind >> of branch which loses the atomic qualities, and result in wrong code. > > Or it might leave the atomic branch, in a place where it isn't really wanted. > > I wonder if this could be avoided by representing the atomic branch by an > UNSPEC rather than by a branch, since it isn't a "normal branch" that GCC > knows about. If the atomic branch is special from an architectural standpoint, then that may be advisable.
Jeff