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] Use bitwise AND/OR/XOR if possible to implement &&, ||, !


On Tue, 26 Aug 2008, Andi Kleen wrote:

> Paolo Bonzini <bonzini@gnu.org> writes:
> 
> > This patch allows GCC to compile boolean &&, ||, ! to simple bitwise
> > AND, OR and XOR operations, when the operands are known to be truth
> > values.
> 
> That is they come out of an earlier truth generating operator like
> ! || && > < etc., right? For bool variables read from memory 
> or coming from function it would be unsafe because
> the values are not necessarily 0 or 1 there. And then could give for 

If the representation of a bool variable is a byte or bytes giving an 
integer value other than 0 or 1, that is a trap representation in ISO C 
terms and the behavior is undefined.

-- 
Joseph S. Myers
joseph@codesourcery.com


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