comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Byte/Bit Twiddling in Ada
Date: 1997/02/15
Date: 1997-02-15T00:00:00+00:00	[thread overview]
Message-ID: <dewar.856015429@merv> (raw)
In-Reply-To: 33048844.7AEB@elca-matrix.ch


Mats asked:

<<(Robert, what kind of code would GNAT generate for these instructions ?
Does the optimizer recognize the CPU's instruction set ?)>>

in reference to slices of bit-packed arrays.

GNAT certainly is in the business of recognizing the CPU instruction set!
That's what the code generation of gcc is all about.

However, that is not the issue here, the issue is very special handling
of these kinds of slices at a level where the GCC optimizer could 
generate good code. This is not currently done.

Note that if you want to do shifts or rotates, the use of modular types
is probably more convenient and natural than writing strange concatenations
and slice assignments. Yes, of course these could be optimized, but we
have rarely seen people try to do, say your rotate case, this way, so it
seems a low priority specialization.

On the other hand, general slice assignments are a useful facility, but
again, this is a relatively rare construct in the code we have seen.
You can of course achieve these kind of effects with shifting and
masking on modular values.

GNAT *does* generate good code for messing with individual bits of a bit
packed array, which seems the most common usage.





  reply	other threads:[~1997-02-15  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5dvfnn$olj@neocad.xilinx.com>
1997-02-14  0:00 ` Byte/Bit Twiddling in Ada Matthew Heaney
1997-02-14  0:00 ` Mats Weber
1997-02-15  0:00   ` Robert Dewar [this message]
1997-02-15  0:00     ` wiljan
1997-02-26  0:00       ` Robert Dewar
1997-02-15  0:00   ` Robert Dewar
1997-02-14  0:00 ` Keith Allan Shillington
replies disabled

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