[rs6000] Fix passing of Coomplex IEEE 128-bit [PR99685]

Message ID 24c4a2e0-6ec2-aabd-9385-2c9ff1747f6f@linux.ibm.com
State New
Headers
Series [rs6000] Fix passing of Coomplex IEEE 128-bit [PR99685] |

Commit Message

Pat Haugen April 26, 2022, 8:06 p.m. UTC
  Fix register count when not splitting Complex IEEE 128-bit args.

For ABI_V4, we do not split complex args. This created a problem because
even though an arg would be passed in two VSX regs, we were only 
advancing the
function arg counter by one VSX register. Fixed with this patch.

Bootstrapped and regression tested on powerpc64(32/64) and powerpc64le.
Ok for master?

-Pat


2022-04-26  Pat Haugen  <pthaugen@linux.ibm.com>

	PR testsuite/99685

gcc/
	* config/rs6000/rs6000-call.cc (rs6000_function_arg_advance_1): Bump
	register count when not splitting IEEE 128-bit Complex.


  		   " altivec instructions are disabled, use %qs"
  

Comments

Segher Boessenkool April 26, 2022, 10:09 p.m. UTC | #1
Hi!

On Tue, Apr 26, 2022 at 03:06:51PM -0500, Pat Haugen wrote:
> Fix register count when not splitting Complex IEEE 128-bit args.
> 
> For ABI_V4, we do not split complex args.

Because that is what the ABI requires, yes :-)

> This created a problem because
> even though an arg would be passed in two VSX regs, we were only 
> advancing the
> function arg counter by one VSX register. Fixed with this patch.

> gcc/
> 	PR testsuite/99685
> 	* config/rs6000/rs6000-call.cc (rs6000_function_arg_advance_1): Bump
> 	register count when not splitting IEEE 128-bit Complex.

Note where the PR marker goes.

> +	  /* If we are not splitting Complex IEEE 128-bit args then account 
> for

You sent the patch as format=flawed.  Don't.  It does not work.

> +	     the fact that they are passed in 2 VSX regs. */
> +	  if (! targetm.calls.split_complex_arg && type

No space after "!" (or any other unary operator not written with
letters).

> +	      && TREE_CODE (type) == COMPLEX_TYPE && elt_mode == KCmode)
> +	    cum->vregno++;
> +

With those trivialities fixed, okay for trunk.  Thanks!


Segher
  
Pat Haugen May 10, 2022, 4:08 p.m. UTC | #2
Ping.

On 4/26/22 3:06 PM, Pat Haugen via Gcc-patches wrote:
> Fix register count when not splitting Complex IEEE 128-bit args.
> 
> For ABI_V4, we do not split complex args. This created a problem because
> even though an arg would be passed in two VSX regs, we were only 
> advancing the
> function arg counter by one VSX register. Fixed with this patch.
> 
> Bootstrapped and regression tested on powerpc64(32/64) and powerpc64le.
> Ok for master?
> 
> -Pat
> 
> 
> 2022-04-26  Pat Haugen  <pthaugen@linux.ibm.com>
> 
>      PR testsuite/99685
> 
> gcc/
>      * config/rs6000/rs6000-call.cc (rs6000_function_arg_advance_1): Bump
>      register count when not splitting IEEE 128-bit Complex.
> 
> 
> diff --git a/gcc/config/rs6000/rs6000-call.cc 
> b/gcc/config/rs6000/rs6000-call.cc
> index f06c692..9d18607 100644
> --- a/gcc/config/rs6000/rs6000-call.cc
> +++ b/gcc/config/rs6000/rs6000-call.cc
> @@ -1111,6 +1111,12 @@ rs6000_function_arg_advance_1 (CUMULATIVE_ARGS 
> *cum, machine_mode mode,
>       {
>         cum->vregno += n_elts;
> 
> +      /* If we are not splitting Complex IEEE 128-bit args then account 
> for
> +         the fact that they are passed in 2 VSX regs. */
> +      if (! targetm.calls.split_complex_arg && type
> +          && TREE_CODE (type) == COMPLEX_TYPE && elt_mode == KCmode)
> +        cum->vregno++;
> +
>         if (!TARGET_ALTIVEC)
>           error ("cannot pass argument in vector register because"
>              " altivec instructions are disabled, use %qs"
  

Patch

diff --git a/gcc/config/rs6000/rs6000-call.cc 
b/gcc/config/rs6000/rs6000-call.cc
index f06c692..9d18607 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -1111,6 +1111,12 @@  rs6000_function_arg_advance_1 (CUMULATIVE_ARGS 
*cum, machine_mode mode,
  	{
  	  cum->vregno += n_elts;

+	  /* If we are not splitting Complex IEEE 128-bit args then account for
+	     the fact that they are passed in 2 VSX regs. */
+	  if (! targetm.calls.split_complex_arg && type
+	      && TREE_CODE (type) == COMPLEX_TYPE && elt_mode == KCmode)
+	    cum->vregno++;
+
  	  if (!TARGET_ALTIVEC)
  	    error ("cannot pass argument in vector register because"