Hi Richard Sandiford,

Thanks for your continuing help.

On 22/06/2026 21:30, Richard Sandiford wrote:
There is a greater practical difference in the encoding of VECTOR_CST:

The tree_vector_builder in vect_create_constant_vectors has
one element per pattern, therefore encoded_nelts is simply the number of
patterns (i.e. element values) in gimple_build_vector. If the vector is
constant then builder->build () uses that encoding. However,
builder->build () requires the number of patterns to be an integral
power of 2, which may not be true for the number of element values
supplied by BB SLP.

encoded_nelts is also the number of element values in
gimple_build_vector_from_elems, but here build_vector_from_ctor sets
step to 2 for VLA vector types (e.g., encoding {1, 0}, {2, 0}, {3, 0},
{0, 0} if a VLA type with lower bound 4 existed) instead of step 1,
which is a different encoding from that used for the tree_vector_builder
in vect_create_constant_vectors (e.g., {1}, {2}, {3}). The latter would
be invalid without zero-padding as in my first patch version because the
number of patterns might not be an integral power of 2.

FWIW, the nomenclature and notation here isn't the one that I'm used to.
It sounds like you're using "step" to mean "nelts_per_pattern".  But to mem
"step 2" means an "encoding with nelts_per_pattern == 3 and a step of 2
between elements 1 and 2 of a pattern".  For example:
Yes, I am sorry about that. I did not realise until I had sent that email how horribly confusing it would be to use the term "step" for number of elements per pattern.

I did so simply because "step" is a variable in the build_vector_from_ctor function that is used with the meaning "number of elements per pattern". (Its value is passed as the last argument to a tree_vector_builder constructor.) I think that variable should be renamed.

--
Christopher Bazley
Staff Software Engineer, GNU Tools Team.
Arm Ltd, 110 Fulbourn Road, Cambridge, CB1 9NJ, UK.
http://www.arm.com/

Reply via email to