This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: clearing many bytes variables (could use one machine instruction)?
On 09/03/2010 17:42, Basile Starynkevitch wrote:
> I knew about vectorization (of which I am not an expert), and I didn't
> mention it, because in my view this is not exactly vectorization.
Agreed.
> And I don't want to use an array of bytes for that purpose. I want to have a
> rather large number of individual variables.
> typedef char melt_flag_t; /* or perhaps bool */
>
> {
> /* typically dozens or even a hundred of cleared variables */
> melt_flag_t f0=0, f1=0, f2=0, f3=0, f4=0, f5=0, f6=0, f7=0, f8=0, f9=0;
>
> /* some complex code with conditionals and forward gotos,
> where each above flag is set at most once, and may be tested many times */
> }
>
> I don't want to use an array
> So I asked myself if GCC can clear efficiently a set of variables
> (BTW, this is mandatory in Java), hence my initial question.
>
> In my view, aggregating several small scalar variables inside a larger word
> data is not exactly vectorization (my perception of vectorization is that it
> is dealing with arrays).
Yes, I think so; aggregation is the right word for it. Or maybe
scalarization. If you wrap all these chars in a struct, can SRA handle it?
cheers,
DaveK