This is the mail archive of the gcc@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: Is it safe to use _Bool as asm statement outputs on x86?


On 06/02/2015 06:02 PM, Richard Henderson wrote:
> On 06/02/2015 04:46 PM, H. Peter Anvin wrote:
>> For the x86 backend explicitly, is doing something like:
>>
>>     _Bool x;
>>
>>     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.
> In particular:
> 
>  (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.
> 

That is all good as far as I am concerned.

	-hpa



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