This is the mail archive of the
mailing list for the GCC project.
Re: Is it safe to use _Bool as asm statement outputs on x86?
- From: Richard Henderson <rth at redhat dot com>
- To: "H. Peter Anvin" <hpa at zytor dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 02 Jun 2015 18:02:33 -0700
- Subject: Re: Is it safe to use _Bool as asm statement outputs on x86?
- Authentication-results: sourceware.org; auth=none
- References: <556E4067 dot 3090905 at zytor dot com>
On 06/02/2015 04:46 PM, H. Peter Anvin wrote:
For the x86 backend explicitly, is doing something like:
asm("blah ; setc %0" : "=qm" (x));
... guaranteed to be safe for older versions of gcc?
I believe so, for the restricted set of conditions I expect you're asking.
(1) Linux has always defined _Bool as a byte (indeed, afaik only Darwin
has ever done otherwise).
(2) You must really produce 0/1 from the asm; the compiler doesn't re-do
the canonicalization afterward, and afaik we do rely on that in the
optimizers. But certainly that's true for any version of GCC.