This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Even stricter implicit conversions between vectors


Recently I proposed that implicit conversions between vectors with
differing numbers of elements yet the same total bitlength be disallowed.
It was agreed that this was reasonable, and I shall be submitting a
patch to vector_types_convertible_p and the testsuite in the near future.

I would now like to propose that the check in that function be made
even stronger such that it disallows conversions between vectors
whose element types differ -- even if an implicit conversion exists
between those element types.

There are three examples I know about where it seems that this decision
has been made:

- the C++ valarray class, whose assignment operators are declared to
be of the form (note the parameterization upon only one type):

valarray<T>& operator=(const valarray<T>&);

- the AltiVec programming interface manual, which reads in section
2.4.2 "If either the left hand side or right hand side of an expression
has a vector type, then both sides of the expression must be of the same
vector type.";

- the ARM NEON architecture, where there is a similar expectation.

To my mind it seems reasonable that the decisions made by
vector_types_convertible_p should match examples like this.  What do
others think?

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]