Yes, at least the first case (scalar operand 2) is supported by valarray.
http://www.reading.ac.uk/SerDepts/su/Topic/Pgram/PgSWC+FP01/Workshop/stdlib/stdref/val_6244.htm#Non-member%20Binary%20Operators
Additionally, if we follow valarray guideline, GCC should also support code
like:
V4H a, c;
short b;
c = a + b;
Instead of using
c = a + (V4H){b, b, b, b};
This can be useful.
> -----Original Message-----
> From: Joseph Myers [mailto:[email protected]]
> Sent: 24 February 2009 18:52
> To: Bingfeng Mei
> Cc: [email protected]
> Subject: Re: Native support for vector shift
>
> On Tue, 24 Feb 2009, Bingfeng Mei wrote:
>
> > Currently, we have to use intrinsics to support such shift.
> Isn't syntax
> > of vector shift intuitive enough to be supported natively?
> Someone may
> > argue it breaks the C language. But vector is a GCC
> extension anyway.
> > Support for vector add/sub/etc already break C syntax. Any thought?
>
> The general guideline we've followed for C vector extensions
> is "like C++
> valarray". Does it support this? (This isn't an absolute
> rule in either
> direction, but a useful guide and a set of semantics that have been
> well-tested in practice.)
>
> --
> Joseph S. Myers
> [email protected]
>
>