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?

> +      /* 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?

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

Typo ("available").

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

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

Thanks,


Segher

Reply via email to