On Tue, Apr 12, 2016 at 09:01:58AM -0400, Andrew MacLeod wrote:
> 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 :-).

For the __builtin_*_overflow builtins, we lower them into internal functions
that return complex integer that contains both the values we want (result
and overflow flag) and then just extract the real and imag part of that.
Ugly, but it works without major changes to all optimizers.

        Jakub

Reply via email to