[PATCH, vectorizer]: Take2: Vectorize FP conversions

Uros Bizjak ubizjak@gmail.com
Sun Apr 22 12:41:00 GMT 2007


Dorit Nuzman wrote:

>>> This is the second revision of the FP conversions patch. In addition
>>> to conversions, this patch renames VEC_PACK_MOD_EXPR (and
>>> corresponding optabs) to VEC_PACK_TRUNC_OPTAB. Following this rename,
>>> vec_pack_trunc_optab also handles FP modes, so we don't have to invent
>>> another trunc optab just for floating modes.
>>>       
> I'm sorry for not raising the following question before (didn't occur to me
> until now): Do we really need to duplicate the vec_unpack optab for floats,
> rather than reusing the vec_unpacks for both ints and floats, just like
> optabs smul,smin,smax? (either way is fine with me, just a question of
> general optab policy in gcc)
>   
I would propose to rename proposed  vec_unpack_hi/lo_<mode> into 
vec_unpack_extend_hi/lo_<mode>, just like vec_pack_trunc_<mode> for 
truncation. This operation is in fact unpacking _and_ extending hi or lo 
part of operand. In this manner, an operation that unpacks and converts 
to float SImode operands could then be named 
vec_unpack_float_hi/lo_<mode>, where mode is SImode (i.e. cvtdq2pd x86 
instruction).

I think that vec_unpackS_X is a but unfortunate name for FP operands, as 
the concept of signed and usigned operation doesn't apply there. We 
could use the name, which "defults" to sign extension, as it is the case 
with div/udiv. Perhaps for vector operations, the "default" pack 
operation would mean truncation and "default" unpack operation would 
mean extension. Something like this:

vec_unpack_zext_hi/lo -> unpack with zero extension
vec_unpack_hi/lo -> unpack with signed extension or with FP extension
vec_unpack_float_hi/lo -> unpack with conversion to FP
vec_unpack_floatuns_hi/lo -> unpack with unsigned conversion to FP
vec_unpack_fix_hi/lo ->  unpack with conversion from FP
...

vec_pack_[s|u]sat -> pack with signed/unsigned saturation
vec_pack -> pack with truncation or with FP truncation
vec_pack_float -> pack with conversion to FP
...
>
>   
>> Index: gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c
>> ===================================================================
>> --- gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c   (revision 0)
>> +++ gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c   (revision 0)
>> @@ -0,0 +1,40 @@
>> +/* { dg-require-effective-target vect_double } */
>>     
> ...
>   
>> +
>> +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"
>> { target i?86-*-* x86_64-*-* } } } */
>>     
>
> I would xfail on spu instead.
>
>   
This is OK with me.

Uros.



More information about the Gcc-patches mailing list