On 04/12/2016 04:35 AM, Richard Biener wrote:
On Mon, 11 Apr 2016, Jeff Law wrote:
On 04/08/2016 10:10 AM, Jakub Jelinek wrote:
On Fri, Apr 08, 2016 at 06:04:38PM +0200, Richard Biener wrote:
Hmm, don't we simply want to do this for all stmts (OK, only asm have
multiple defs...)?
For all stmts that have multiple defs (which is only GIMPLE_ASM right now).
I thought the atomic support added support for statements with multiple
outputs?
Maybe on a branch. Historically all gimples had the ability to have
multiple DEFs but this was removed as having excessive memory requirement.
Later DEFs handling was simplified and we no longer keep def "operands"
explicit but the iterators know how to get at all possible defs. Which
makes it "currently only ASMs can have multiple (non-virtual) defs".
See ssa-iterators.h:op_iter_init and op_iter_next_def.
Richard.
I poked around for a while and found a patch from late 2012 where I was
attempting to implement atomics as a gimple primitive (GIMPLE_ATOMIC).
That work did indeed add the ability of the CAS primitive to return 2
values to op_iter_init and friends. I recall there were maybe a half
dozen places in the compiler that needed to be updated to deal with 2
results for a gimple statement.
It never went anywhere because I ran into a bunch of other problems that
frustrated me and led me down the frontend/backend separation path :-P
Today, we still just let RTL patterns optimize the conditional result
and expected-value address parameter from a compare_exchange... so we
simply bypass the 2 results issue for a CAS and push it to the target :-).
Andrew