This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH], PR target/84914, Fix complex long double multiply/divide on PowerPC -mabi=ieeelongdouble


On Wed, Mar 21, 2018 at 11:42:01AM -0400, Michael Meissner wrote:
> +/* Create a decl for either complex long double multiply or complex long double
> +   divide when long double is IEEE 128-bit floating point.  We can't use
> +   __multc3 and __divtc3 because the original long double using IBM extended
> +   double used those names.  The complex multiply/divide functions are encoded
> +   as builtin functions with a complex result and 4 scalar inputs.  */

The function is much more generic than that (other than the name and the
debug printf).

> +static void
> +create_complex_muldiv (const char *name, built_in_function fncode, tree fntype)
> +{
> +  tree fndecl = add_builtin_function (name, fntype, fncode, BUILT_IN_NORMAL,
> +				      name, NULL_TREE);
> +
> +  set_builtin_decl (fncode, fndecl, true);
> +
> +  if (TARGET_DEBUG_BUILTIN)
> +    fprintf (stderr, "create complex %s, fncode: %d, fndecl: 0x%lx\n", name,
> +	     (int) fncode, (unsigned long)fndecl);

Space after cast.  Don't cast pointers to integer, just use %p.  Is this
address useful to print at all?

> @@ -18689,6 +18710,24 @@ init_float128_ieee (machine_mode mode)
>  {
>    if (FLOAT128_VECTOR_P (mode))
>      {
> +      /* Set up to call __mulkc3 and __divkc3 under -mabi=ieeelongdouble.  */
> +     if (mode == TFmode && TARGET_IEEEQUAD)
> +       {
> +	 built_in_function fncode_mul =
> +	   (built_in_function)(BUILT_IN_COMPLEX_MUL_MIN + TCmode - MIN_MODE_COMPLEX_FLOAT);
> +	 built_in_function fncode_div =
> +	   (built_in_function)(BUILT_IN_COMPLEX_DIV_MIN + TCmode - MIN_MODE_COMPLEX_FLOAT);

Space after cast, lines too long.  Put TCmode - MIN_MODE_COMPLEX_FLOAT in
a temp, maybe?

> --- gcc/testsuite/gcc.target/powerpc/mulkc3-3.c	(revision 0)
> +++ gcc/testsuite/gcc.target/powerpc/mulkc3-3.c	(revision 0)
> @@ -0,0 +1,16 @@
> +/* { dg-do compile { target { powerpc64*-*-* } } } */

Does powerpc*-*-* not work?

> +/* { dg-require-effective-target powerpc_p9vector_ok } */
> +/* { dg-options "-O2 -mpower8-vector -mabi=ibmlongdouble -Wno-psabi" } */

powerpc_p9vector_ok but -mpower8-vector, that is strange.


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]