Richard Biener <rguent...@suse.de> writes: >> What do we allow for non-boolean constructors. E.g. for: >> >> v2hi = 0xf001; >> >> do we allow the CONSTRUCTOR to be { 0xf001 }? Is the type of an >> initialiser value allowed to be arbitrarily different from the type >> of the elements being initialised? >> >> Or is there requirement that (say) each constructor element is either: >> >> - a scalar that initialises one element of the constructed vector >> - a vector of N elements that initialises N elements of the constructed >> vector >> >> ? >> >> Like you say, it mostly seems like guesswork how booleans would be >> handled here, but personally I don't know the answer for non-booleans >> either :-) > > There's extensive checking in tree-cfg.c for vector CTORs meanwhile. > We only supporm uniform element CTORs with only trailing zeros elided. > And the elements need to either have types of the vector component > or be vectors with such component.
Ah, great. So in that case, could we ditch bitsize altogether and just use: unsigned int nelts = (VECTOR_TYPE_P (val_type) ? TYPE_VECTOR_SUBPARTS (val_type).to_constant () : 1); or equivalent to work out the number of elements being initialised by each constructor element? Thanks, Richard