This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use bitwise AND/OR/XOR if possible to implement &&, ||, !
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: Paolo Bonzini <bonzini at gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Aug 2008 19:53:43 +0000 (UTC)
- Subject: Re: [PATCH] Use bitwise AND/OR/XOR if possible to implement &&, ||, !
- References: <g90mvi$i35$1@ger.gmane.org> <87prnwrlvf.fsf@basil.nowhere.org>
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