This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Design for flag bit outputs from asms
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Linus Torvalds <torvalds at linux-foundation dot org>
- Cc: Richard Henderson <rth at redhat dot com>, Peter Zijlstra <peterz at infradead dot org>, Vladimir Makarov <vmakarov at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Ingo Molnar <mingo at kernel dot org>, "H. Peter Anvin" <hpa at zytor dot com>, Thomas Gleixner <tglx at linutronix dot de>, Linux Kernel Mailing List <linux-kernel at vger dot kernel dot org>, Borislav Petkov <bp at alien8 dot de>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 5 May 2015 11:10:27 -0500
- Subject: Re: [RFC] Design for flag bit outputs from asms
- Authentication-results: sourceware.org; auth=none
- References: <20150501151630 dot GH5029 at twins dot programming dot kicks-ass dot net> <CA+55aFwBP9QjpRK50pdVHmc086-+QPCthJRUs8Gq5qJBnXqnJQ at mail dot gmail dot com> <20150501163329 dot GU1751 at tucnak dot redhat dot com> <5543CDC0 dot 6010206 at redhat dot com> <CA+55aFxOd6mJcezgoLHN9Zgds-CsJqsx4Jgkp9OP1xUf11727Q at mail dot gmail dot com> <20150502123958 dot GK5029 at twins dot programming dot kicks-ass dot net> <5547C992 dot 9000703 at redhat dot com> <20150505135005 dot GA4850 at gate dot crashing dot org> <CA+55aFyCc-TkecTdmAzta8fcAsJHoAK3CF6XPNT6ury+ZPOy=w at mail dot gmail dot com>
On Tue, May 05, 2015 at 08:37:01AM -0700, Linus Torvalds wrote:
> On Tue, May 5, 2015 at 6:50 AM, Segher Boessenkool
> <firstname.lastname@example.org> wrote:
> > Since it is pre-processed, there is no real reason to overlap this with
> > the constraints namespace; we could have e.g. "=@[xy]" (and "@[xy]" for
> > inputs) mean the target needs to do some "xy" transform here.
> In fact, standing out visually would be just a good thing, since it's
> pretty special even from a usage standpoint.
> And are you actually planning to have flags as inputs? Because *that*
> sounds like a bad idea. It's pretty hard to turn a boolean into a flag
> value, while pretty much any archiecture has an operation like "setcc"
> to go the other way. And I don't think your machine descriptions have
> anything to "generate flags". You'd have to add fragile and complex
> machinery for something it is unlikely anybody ever wants.
It isn't hard (or expensive) to turn integers into flags, on many
targets. It is nice to allow this at least in the generic part of
the code -- what targets do in their target hook is up to them.
It isn't fragile or complex. Not useful on some archs, yes I certainly
believe that. But the lovely thing about Richard's proposal is that it
actually is a very simple addition to what the compiler already does,
there are no hard new optimisations needed, it's just a bit of munging
to allow the user to write an asm with condition code in/outs. Allowing
inputs is just another bool argument to the target hook. I'd rather
have this more orthogonal than more specialised; it can be used for much
more than just condition codes. It's not like the "more general" syntax
would be a burden, as far as I see.