Hi Kewen,

On Fri, Sep 27, 2019 at 10:33:01AM +0800, Kewen.Lin wrote:
> This patch is to add the support for float from/to long conversion
> vectorization.  ISA 2.06 supports the vector version instructions
> for conversion between float and long long (both signed and unsigned),
> but vectorizer can't exploit them since the optab check fails.

Nice :-)

> +;; 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.

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

With either way, approved for trunk (after testing, of course).  Thanks!


Segher

Reply via email to