Before r266366, clang used to support constructs like:
typedef __attribute__((vector_size(8))) double float64x1_t; typedef __attribute__((vector_size(16))) double float64x2_t; float64x1_t vget_low_f64(float64x2_t __p0); double y = 3.0 + vget_low_f64(v);
But it would reject:
double y = vget_low_f64(v) + 3.0;
It also always rejected assignments:
double y = vget_low_f64(v);
This patch: (a) revivies the behavior of 3.0 + vget_low_f64(v) prior to
r266366, (b) add support for vget_low_f64(v) + 3.0 and (c) add support for
assignments.
These vector semantics have never really been tied up but it seems
odd that we used to support some binop froms but do not support
assignment. If we did support scalar for the purposes of arithmetic, we
should probably be able to reinterpret as scalar for the purposes of
assignment too.
Why should we allow this conversion? I don't see how <2 x float> and double should be convertible. I'm not sure why we allow f2 += d above, but I think of it as "widening" the type from scalar to vector.
Would it be OK for your if we tightened our lax vector conversion checks to just allow conversion from <1 x T> to T? The test case in the summary seems like pretty reasonable code, even if GCC rejects.