[PATCH 2/5] Add Power10 XXSPLTI* and LXVKQ instructions (LXVKQ)

Michael Meissner meissner@linux.ibm.com
Fri Nov 5 18:01:45 GMT 2021


On Fri, Nov 05, 2021 at 12:52:51PM -0500, will schmidt wrote:
> > diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
> > index 956e42bc514..e0d1c718e9f 100644
> > --- a/gcc/config/rs6000/predicates.md
> > +++ b/gcc/config/rs6000/predicates.md
> > @@ -601,6 +601,14 @@ (define_predicate "easy_fp_constant"
> >    if (TARGET_VSX && op == CONST0_RTX (mode))
> >      return 1;
> > 
> > +  /* Constants that can be generated with ISA 3.1 instructions are easy.  */
> 
> Easy is relative, but OK.

The names of the function is easy_fp_constant.

> > +  vec_const_128bit_type vsx_const;
> > +  if (TARGET_POWER10 && vec_const_128bit_to_bytes (op, mode, &vsx_const))
> > +    {
> > +      if (constant_generates_lxvkq (&vsx_const) != 0)
> > +	return true;
> > +    }
> > +
> >    /* Otherwise consider floating point constants hard, so that the
> >       constant gets pushed to memory during the early RTL phases.  This
> >       has the advantage that double precision constants that can be
> > @@ -609,6 +617,23 @@ (define_predicate "easy_fp_constant"
> >     return 0;
> >  })
> > 
> > +;; Return 1 if the operand is a special IEEE 128-bit value that can be loaded
> > +;; via the LXVKQ instruction.
> > +
> > +(define_predicate "easy_vector_constant_ieee128"
> > +  (match_code "const_vector,const_double")
> > +{
> > +  vec_const_128bit_type vsx_const;
> > +
> > +  /* Can we generate the LXVKQ instruction?  */
> > +  if (!TARGET_IEEE128_CONSTANT || !TARGET_FLOAT128_HW || !TARGET_POWER10
> > +      || !TARGET_VSX)
> > +    return false;
> 
> Presumably all of the checks there are valid.  (Can we have power10
> without float128_hw or ieee128_constant flags set?)    I do notice the
> addition of an ieee128_constant flag below.

Yes, we can have power10 without float128_hw.  At the moment, 32-bit big endian
does not enable the 128-bit IEEE instructions.  Also when we are building the
bits in libgcc that can switch between compiling the software routines and the
routines used for IEEE hardware, and when we are building the IEEE 128-bit
software emulation functions we need to explicitly turn off IEEE 128-bit
hardware support.

Similarly for VSX, if the user explicitly says -mno-vsx, then we can't enable
this instruction.

> Ok.  I did look at this a bit before it clicked, so would suggest a
> comment stl "All of the constants that can be loaded by lxvkq will have
> zero in the bottom 3 words, so ensure those are zero before we use a
> switch based on the nonzero portion of the constant."
> 
> It would be fine as-is too.  :-)

Ok.

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com


More information about the Gcc-patches mailing list