Hi!

On Wed, Aug 26, 2020 at 01:27:44PM -0700, Carl Love wrote:
> > > @@ -367,7 +367,7 @@
> > >     UNSPEC_INSERTR
> > >     UNSPEC_REPLACE_ELT
> > >     UNSPEC_REPLACE_UN
> > > - UNSPEC_XXSWAPD_V1TI
> > > + UNSPEC_XXSWAPD_VEC_I128
> > 
> > Why not just UNSPEC_XXSWAPD?  And, why an unspec at all?
> 
> I am trying to figure out how to specify this without using an unpsec
> per your last comment.  I changed the definition to:
> 
> ;; Swap upper/lower 64-bit values in V1TI or TI type
> (define_insn "xxswapd_<mode>"
>   [(set (match_operand:VEC_I128 0 "vsx_register_operand" "=v")
>         (vec_select:VEC_I128
>           (match_operand:VEC_I128 1 "vsx_register_operand" "v")
>           (parallel [(const_int 0)])))]
>   "TARGET_POWER10"
> ;; AIX does not support extended mnemonic xxswapd.  Use the basic
> ;; mnemonic xxpermdi instead.
>   "xxpermdi %x0,%x1,%x1,2"
>   [(set_attr "type" "vecperm")])

(define_insn "xxswapd_<mode>"
  [(set (match_operand:VEC_I128 0 "vsx_register_operand" "=v")
        (subreg:VEC_I128
          (vec_select:V2DI
            (match_operand:V2DI 1 "vsx_register_operand" "v")
            (parallel [(const_int 1) (const_int 0)]))
          0))]

or similar (i.e., just cast it to the type you want -- in hardware, all
vectors are just an opaque 128 bits, but in RTL they have a type).

(You probably want to cast operands[1] as well).


Segher

Reply via email to