Alinabi wrote:

Subject: sub-optimal code for packed boolean arrays in Ada -- bug or
inherent limitation

Certainly not a bug, the code generated is correct, it is just not
optimal. Surely it could be fixed if someone had the energy to do so.
I see no particular gain in filing a bug report, it is unlikely this
will cause someone else to jump into action to improve the code in this
case.

The most effective way to get something done here would be for you
to investigate how this could be improved, the relevant unit in the
compiler is exp_pakd.adb. Feel free to ask if you have questions
on the internals of this unit.

    pragma Inline_Always(Set, Clear, Flip, Is_Set);

pragma Inline is usually a better choice when using gcc, Inline_ALways
is there primarily for non-gcc targets, and its use with gcc is
deprecated.

I don't know much (if anything) about compiler internals, so I was
wondering if I should file a bug report. Is there some good
theoretical justification for all those extraneous shifts and
rotations?

No, there is no theoretical justification, just a case of non-optimal
code.

I would think that if the compiler can figure out the best
way to set or clear a bit in a register using shift and logical ops,
than it should also be able to negate it efficiently.

Most certainly it could, it just does not happen to optimize this
particular case.

Reply via email to