size value of vector_size attribute

Marc Glisse marc.glisse@inria.fr
Mon Dec 16 07:19:00 GMT 2019


On Mon, 16 Dec 2019, Xi Ruoyao wrote:

> Is there any reason to enforce "x must be a power of 2" in
> __attribute__((vector_size(x)))?
>
> I want to use this attribute in my source code to simplify coding
> (instead of utilizing SIMD instructions, normally).  Someone may argue
> that I should use std::valarray but it is stupidly slow.  Now with this
> restriction on size value I may have to write something like
> std::valarray but w/o dynamic allocation.

See PR53024. One main reason is that supporting it would be some work, for 
not enough demand. Also, it can be done in user code, compiler support is 
not necessary (it would be convenient though). Even lowering an 
unsupported power of 2 to a set of smaller vectors still generates pretty 
bad code IIRC.

By the way, for 3 double on x86, would you prefer __m128d+double, or 
__m256d with one slot ignored?

-- 
Marc Glisse



More information about the Gcc-help mailing list