This is the mail archive of the 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]

Re: [PATCH, rs6000] Support float from/to long conversion vectorization

Hi Segher,

on 2019/9/27 下午3:27, Segher Boessenkool wrote:
> Hi Kewen,
>> +;; Support signed/unsigned long long to float conversion vectorization.
>> +(define_expand "vec_pack<su>_float_v2di"
>> +  [(match_operand:V4SF 0 "vfloat_operand")
>> +   (any_float:V4SF (parallel [(match_operand:V2DI 1 "vint_operand")
>> +     (match_operand:V2DI 2 "vint_operand")]))]
> To concatenate two vectors, the syntax is vec_concat.  So
>   [(set (match_operand:V4SF 0 "vfloat_operand")
> 	(any_float:V4SF
> 	  (vec_concat:V4DI (match_operand:V2DI 1 "vint_operand")
> 			   (match_operand:V2DI 2 "vint_operand"))))]
> It is of course a define_expand here, and it always calls DONE, so the
> only thing the RTL template is used for is the match_operands; but also
> important here is that you use an iterator (any_float), so you need to
> work that into the template some way.
> Your code would work, but it is a bit misleading, an unsuspecting reader
> (*cough* me *cough*) might think this is the actual insn this expander
> will create.
>> +;; Support float to signed/unsigned long long conversion vectorization.
>> +(define_expand "vec_unpack_<su>fix_trunc_hi_v4sf"
>> +  [(match_operand:V2DI 0 "vint_operand")
>> +   (any_fix:V2DI (match_operand:V4SF 1 "vfloat_operand"))]
> Similarly here: the pattern as you wrote it isn't valid RTL.
>   [(set (match_operand:V2DI 0 "vint_operand")
> 	(any_fix:V2DI (vec_select:V2SF ...
> uh-oh, we do not have a mode V2SF.
> Let's go with what you have then, add a comment that the template isn't
> valid RTL, but you need it for the iterator?
> Or can you think of a different way of putting an iterator like this in
> the template?  Maybe something like
> (define_expand "vec_unpack_<su>fix_trunc_hi_v4sf"
>   [(match_operand:V2DI 0 "vint_operand")
>    (match_operand:V4SF 1 "vfloat_operand")
>    (any_fix (pc))]
> works?  If it does, please do that; if you cannot find a reasonably clear
> syntax, go with what you had, but please add a comment saying the template
> won't ever be inserted as instruction.

Thanks for your advice on "any_fix (pc)", it works perfectly by testing.
Attached patch has adopted this writing and add a comment saying it's just
for code attribute.  Bootstrapped, I'll commit it once regress tested.

> (Maybe one of the gen* tools complains any_fix needs a mode? :QI will do
> if so, or :P if you like that better).

I didn't encounter any errors, it sounds it's allowable now?


Attachment: SP_LL_conv_vect1.patch
Description: Text document

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