Agreed, which is why I suggested the "spill the _comparison_, not the
actual cc0 register" approach.
That way, if you have to spill, you'll end up at worst with the same code
we already have to have, ie the code will end up something like
lock ; decl mem
seta %al <- spill comparison to %al
..
testb %al,%al <- re-do comparison test later
jne ..
> Actually what can be feasible is to make asm statement set flags and follow
> it by store flag instruction that will be used in the conditional. Later
> the combine pass should be able to get it connected.
That sounds pretty ideal - have some way of telling gcc to add a "seta
%reg", while at the same time telling gcc that if it can elide the "seta"
and use a direct jump instead, do so..
> The design of asm statements should be IMO re-tought. I think it has been
> mistake to make them so low level and allow user to write constraints directly,
> so perhaps we can think about big change for future gcc...
I don't see many alternatives. The fact is, asm's end up being used
exactly when gcc simply doesn't know what to do, so gcc doesn't know what
the constraints are either.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/