This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ssa coalescing with inline asm (PR middle-end/70593)


On 04/12/2016 09:06 AM, Jakub Jelinek wrote:
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
I suppose it shouldn't be too hard to abstract it a bit so that we aren't special casing GIMPLE_ASM, but rather check a flag on the statement kind and use a call back to handle the multiple defs that need handling as an exception.. And do it in some way so it doesn't slow down the normal case.

I expect everything required is buried somewhere in my patch. Maybe someday when I'm looking for a something smallish and different to do I'll have a look and see if there is anything worth pursuing. It does seem to come up every year or two.

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]