comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: GNAT 4.4.5 order of conditional processing?
Date: Tue, 15 Nov 2011 17:18:30 -0800 (PST)
Date: 2011-11-15T17:18:30-08:00	[thread overview]
Message-ID: <8f003611-8375-4de7-bfd0-1d6b3f910c30@m13g2000prl.googlegroups.com> (raw)
In-Reply-To: j9urg4$cke$1@tornado.tornevall.net

On Nov 15, 3:08 pm, Jeffrey Carter
<spam.jrcarter....@spam.not.acm.org> wrote:
>
> Note that the short circuit forms should not be considered optimizations. With
> modern processors, unnecessary short-circuit forms may sometimes be slower than
> the regular equivalents.

Yeah, but the compiler should be able to figure it out and generate
the best code.  No matter what the Ada language says, if you write "A
and then B" and A and B are Boolean variables, it's perfectly legal
for the compiler to generate an instruction that reads the register
that currently contains B.  (I mean a normal register, not a memory-
mapped I/O register.)  The only time it should be necessary to use
"and" instead of "and then" (on Boolean operands) is if the right side
contains a function call (or, perhaps, a read of a variable that's
mapped to some special hardware address) that you absolutely want to
take place regardless of the left side.

                              -- Adam



  reply	other threads:[~2011-11-16  1:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 20:30 GNAT 4.4.5 order of conditional processing? awdorrin
2011-11-15 20:54 ` Niklas Holsti
2011-11-15 21:07   ` awdorrin
2011-11-15 21:23     ` Vinzent Hoefler
2011-11-15 21:49       ` awdorrin
2011-11-16 21:31         ` Gautier write-only
2011-11-16 22:40           ` Adam Beneschan
2011-11-17  0:00             ` Adam Beneschan
2011-11-15 23:08 ` Jeffrey Carter
2011-11-16  1:18   ` Adam Beneschan [this message]
2011-11-16  5:33     ` tmoran
2011-11-16 17:52       ` awdorrin
2011-11-16 20:01         ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox