On Wed, Jun 06, 2018 at 02:52:27PM -0500, Segher Boessenkool wrote:
> On Tue, Jun 05, 2018 at 07:11:41PM -0400, Michael Meissner wrote:
> > This patch makes the long double pack/unpack built-in functions only 
> > available
> > if the long double format is IBM extended double.
> > 
> > I added new pack and unpack functions that use __ibm128 instead of long 
> > double
> > in case somebody needs to build IBM extended double after we have changed 
> > the
> > default to IEEE 128-bit.
> 
> > @@ -15339,10 +15340,9 @@ rs6000_invalid_builtin (enum rs6000_buil
> >    else if ((fnmask & RS6000_BTM_P9_MISC) == RS6000_BTM_P9_MISC)
> >      error ("builtin function %qs requires the %qs option", name,
> >        "-mcpu=power9");
> > -  else if ((fnmask & (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128))
> > -      == (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128))
> > -    error ("builtin function %qs requires the %qs and %qs options",
> > -      name, "-mhard-float", "-mlong-double-128");
> > +  else if ((fnmask & RS6000_BTM_LDBL128) == RS6000_BTM_LDBL128)
> > +    error ("builtin function %qs requires the %qs option", name,
> > +      TARGET_IEEEQUAD ? "-mabi=ibmlongdouble" : "-mlong-double-128");
> 
> This no longer tests for hard float.  Is that correct, i.e. is hard
> float always enabled if we get here?

I originally thought that, but perhaps it is better to add an explict check
once again.

> > +      /* For the pack and unpack int128 routines, fix up the builtin so it
> > +    uses the correct IBM128 type.  */
> > +    case MISC_BUILTIN_PACK_IF:
> > +      if (TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD)
> > +   {
> > +     icode = CODE_FOR_packtf;
> > +     fcode = MISC_BUILTIN_PACK_TF;
> > +     uns_fcode = (size_t)fcode;
> > +   }
> > +      break;
> > +
> > +    case MISC_BUILTIN_UNPACK_IF:
> > +      if (TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD)
> > +   {
> > +     icode = CODE_FOR_unpacktf;
> > +     fcode = MISC_BUILTIN_UNPACK_TF;
> > +     uns_fcode = (size_t)fcode;
> > +   }
> > +      break;
> 
> (Space after cast, but nothing here does that I see).
> 
> Is this correct?  Why should it not use the IFmode version?

Because in the patch that I just commited (patch #2), we use the TF type for
__ibm128 when long double is IBM 128-bit.  This makes templates work.
Otherwise if you try a template of __ibm128 and long double, you get an
internal compiler error.

> > +is returned.  The @code{__builtin_unpack_longdouble} function is only
> > +availble if @code{long double} uses the IBM extended double
> > +representation.
> 
> Typo ("available").

Ok.

> > +The @code{__builtin_pack_longdouble} function takes two @code{double}
> > +arguments and returns a @code{long double} value that combines the two
> > +arguments.  The @code{__builtin_pack_longdouble} function is only
> > +availble if @code{long double} uses the IBM extended double
> > +representation.
> 
> And here.

Ok.

> Okay for trunk (and backports) if those are not mistakes or you fix them,
> and maybe add some comment.

I will add a check for hard float back again.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to