public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Allow more PowerPC sibling calls
@ 2011-04-09  2:52 Alan Modra
  2011-04-18 17:34 ` David Edelsohn
  2011-04-18 17:37 ` Nathan Froyd
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Modra @ 2011-04-09  2:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Edelsohn, dalej, mikestump

[-- Attachment #1: Type: text/plain, Size: 14419 bytes --]

This patch enables sibling calls for powerpc in a few more cases, and
fixes bugs exposed by that change.  We now
a) Allow sibling calls via function pointer.  At the time
   rs6000_function_ok_for_sibcall was written, I don't think access to
   arg types of function pointer calls was available in the target
   hook/macro.
b) Allow sibling calls to functions with vector parameters.  Contrary
   to the previous comment about vector parameters, a problem occurs
   with VRSAVE only when the called function has more vector
   parameters than the caller (because VRSAVE bits will already be set
   for the caller's arguments).  Also, the old code did not make any
   attempt to determine whether altivec/vsx registers would actually
   be used to pass args.  Not all vector types fit in these regs.
c) Allow SYSV4 ABI code to make sibling calls to non-local functions
   so long as not both flag_pic and TARGET_SECURE_PLT are set.
   The PIC -msecure-plt call stubs use r30.

sibcall_value_nonlocal_sysv was trying to read the call cookie from
the wrong operand, a latent bug since the pattern wasn't used until
now.  I also fixed a minor problem with CALL_LIBCALL in the call
cookie, which could cause various call insns to match an "n"
constraint rather than a "0" constraint and so give the wrong insn
length.  Bootstrapped and regression tested powerpc64-linux and
powerpc-linux.

This patch does affect darwin, not only in removing what are now
redundant insn patterns, but also (a) and (b) above.  Would someone
please run a bootstrap and regression test on darwin for me?  I don't
have a machine handy to confirm that I didn't break anything there.

I've attached a vector testcase I used to verify some of these
changes.

gcc/
	* config/rs6000/rs6000.c (rs6000_function_arg): Remove CALL_LIBCALL
	when returning call_cookie.
	(rs6000_function_ok_for_sibcall): Allow sibcalls via function
	pointers, to functions with no more vector args than the current
	function, and some non-local calls for ABI_V4.
	* config/rs6000/rs6000.md (sibcall_nonlocal_aix32,
	sibcall_nonlocal_aix64): Combine to ..
	(sibcall_nonlocal_aix<mode>): ..this.  Handle function pointer calls.
	(sibcall_value_nonlocal_aix32, sibcall_value_nonlocal_aix64): Combine..
	(sibcall_value_nonlocal_aix<mode>): ..likewise.
	(*sibcall_nonlocal_sysv<mode>): Handle function pointer calls.
	(sibcall_value_nonlocal_sysv<mode>): Likewise.  Correct call cookie
	operand.
	* config/rs6000/darwin.md (sibcall_nonlocal_darwin64,
	sibcall_value_nonlocal_darwin64, sibcall_symbolic_64,
	sibcall_value_symbolic_64): Delete.
gcc/testsuite/
	* gcc.target/powerpc/ppc-pow.c: Allow for tail calls.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 172094)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -19305,39 +19302,73 @@ rs6000_return_addr (int count, rtx frame
   return get_hard_reg_initial_val (Pmode, LR_REGNO);
 }
 
-/* Say whether a function is a candidate for sibcall handling or not.
-   We do not allow indirect calls to be optimized into sibling calls.
-   Also, we can't do it if there are any vector parameters; there's
-   nowhere to put the VRsave code so it works; note that functions with
-   vector parameters are required to have a prototype, so the argument
-   type info must be available here.  (The tail recursion case can work
-   with vector parameters, but there's no way to distinguish here.) */
+/* Say whether a function is a candidate for sibcall handling or not.  */
+
 static bool
-rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
+rs6000_function_ok_for_sibcall (tree decl, tree exp)
 {
-  tree type;
+  tree fntype;
+
   if (decl)
+    fntype = TREE_TYPE (decl);
+  else
+    fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (exp)));
+
+  /* We can't do it if the called function has more vector parameters
+     than the current function; there's nowhere to put the VRsave code.  */
+  if (TARGET_ALTIVEC_ABI
+      && TARGET_ALTIVEC_VRSAVE
+      && !(decl && decl == current_function_decl))
     {
-      if (TARGET_ALTIVEC_VRSAVE)
-	{
-	  for (type = TYPE_ARG_TYPES (TREE_TYPE (decl));
-	       type; type = TREE_CHAIN (type))
-	    {
-	      if (TREE_CODE (TREE_VALUE (type)) == VECTOR_TYPE)
-		return false;
-	    }
-	}
-      if (DEFAULT_ABI == ABI_DARWIN
-	  || ((*targetm.binds_local_p) (decl)
-	      && (DEFAULT_ABI != ABI_AIX || !DECL_EXTERNAL (decl))))
-	{
-	  tree attr_list = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+      tree type;
+      int nvreg = 0;
 
-	  if (!lookup_attribute ("longcall", attr_list)
-	      || lookup_attribute ("shortcall", attr_list))
-	    return true;
-	}
+      /* Functions with vector parameters are required to have a
+	 prototype, so the argument type info must be available
+	 here.  */
+      for (type = TYPE_ARG_TYPES (fntype);
+	   type;
+	   type = TREE_CHAIN (type))
+	if (TREE_CODE (TREE_VALUE (type)) == VECTOR_TYPE
+	    && (ALTIVEC_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))
+		|| VSX_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))))
+	  nvreg++;
+
+      for (type = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
+	   type;
+	   type = TREE_CHAIN (type))
+	if (TREE_CODE (TREE_VALUE (type)) == VECTOR_TYPE
+	    && (ALTIVEC_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))
+		|| VSX_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))))
+	  nvreg--;
+
+      if (nvreg > 0)
+	return false;
     }
+
+  /* Under the AIX ABI we can't allow calls to non-local functions,
+     because the callee may have a different TOC pointer to the
+     caller and there's no way to ensure we restore the TOC when we
+     return.  With the secure-plt SYSV ABI we can't make non-local
+     calls when -fpic/PIC because the plt call stubs use r30.  */
+  if (DEFAULT_ABI == ABI_DARWIN
+      || (DEFAULT_ABI == ABI_AIX
+	  && decl
+	  && !DECL_EXTERNAL (decl)
+	  && (*targetm.binds_local_p) (decl))
+      || (DEFAULT_ABI == ABI_V4
+	  && (!TARGET_SECURE_PLT
+	      || !flag_pic
+	      || (decl
+		  && (*targetm.binds_local_p) (decl)))))
+    {
+      tree attr_list = TYPE_ATTRIBUTES (fntype);
+
+      if (!lookup_attribute ("longcall", attr_list)
+	  || lookup_attribute ("shortcall", attr_list))
+	return true;
+    }
+
   return false;
 }
 
Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 172094)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -12963,68 +12963,43 @@ (define_insn "*sibcall_value_local64"
   [(set_attr "type" "branch")
    (set_attr "length" "4,8")])
 
-(define_insn "*sibcall_nonlocal_aix32"
-  [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
-	 (match_operand 1 "" "g"))
-   (use (match_operand:SI 2 "immediate_operand" "O"))
+(define_insn "*sibcall_nonlocal_aix<mode>"
+  [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
+	 (match_operand 1 "" "g,g"))
+   (use (match_operand:SI 2 "immediate_operand" "O,O"))
    (use (reg:SI LR_REGNO))
    (return)]
-  "TARGET_32BIT
-   && DEFAULT_ABI == ABI_AIX
+  "DEFAULT_ABI == ABI_AIX
    && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "b %z0"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4")])
-
-(define_insn "*sibcall_nonlocal_aix64"
-  [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
-	 (match_operand 1 "" "g"))
-   (use (match_operand:SI 2 "immediate_operand" "O"))
-   (use (reg:SI LR_REGNO))
-   (return)]
-  "TARGET_64BIT
-   && DEFAULT_ABI == ABI_AIX
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "b %z0"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4")])
-
-(define_insn "*sibcall_value_nonlocal_aix32"
-  [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
-	      (match_operand 2 "" "g")))
-   (use (match_operand:SI 3 "immediate_operand" "O"))
-   (use (reg:SI LR_REGNO))
-   (return)]
-  "TARGET_32BIT
-   && DEFAULT_ABI == ABI_AIX
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "b %z1"
+  "@
+   b %z0
+   b%T0"
   [(set_attr "type" "branch")
    (set_attr "length" "4")])
 
-(define_insn "*sibcall_value_nonlocal_aix64"
+(define_insn "*sibcall_value_nonlocal_aix<mode>"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
-	      (match_operand 2 "" "g")))
-   (use (match_operand:SI 3 "immediate_operand" "O"))
+	(call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
+	      (match_operand 2 "" "g,g")))
+   (use (match_operand:SI 3 "immediate_operand" "O,O"))
    (use (reg:SI LR_REGNO))
    (return)]
-  "TARGET_64BIT
-   && DEFAULT_ABI == ABI_AIX
+  "DEFAULT_ABI == ABI_AIX
    && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "b %z1"
+  "@
+   b %z1
+   b%T1"
   [(set_attr "type" "branch")
    (set_attr "length" "4")])
 
 (define_insn "*sibcall_nonlocal_sysv<mode>"
-  [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
+  [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
 	 (match_operand 1 "" ""))
-   (use (match_operand 2 "immediate_operand" "O,n"))
+   (use (match_operand 2 "immediate_operand" "O,n,O,n"))
    (use (reg:SI LR_REGNO))
    (return)]
   "(DEFAULT_ABI == ABI_DARWIN
-     || DEFAULT_ABI == ABI_V4)
+    || DEFAULT_ABI == ABI_V4)
    && (INTVAL (operands[2]) & CALL_LONG) == 0"
   "*
 {
@@ -13034,7 +13009,9 @@ (define_insn "*sibcall_nonlocal_sysv<mod
   else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
     output_asm_insn (\"creqv 6,6,6\", operands);
 
-  if (DEFAULT_ABI == ABI_V4 && flag_pic)
+  if (which_alternative >= 2)
+    return \"b%T0\";
+  else if (DEFAULT_ABI == ABI_V4 && flag_pic)
     {
       gcc_assert (!TARGET_SECURE_PLT);
       return \"b %z0@plt\";
@@ -13042,8 +13019,8 @@ (define_insn "*sibcall_nonlocal_sysv<mod
   else
     return \"b %z0\";
 }"
-  [(set_attr "type" "branch,branch")
-   (set_attr "length" "4,8")])
+  [(set_attr "type" "branch")
+   (set_attr "length" "4,8,4,8")])
 
 (define_expand "sibcall_value"
   [(parallel [(set (match_operand 0 "register_operand" "")
@@ -13068,23 +13045,25 @@ (define_expand "sibcall_value"
 
 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
+	(call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
 	      (match_operand 2 "" "")))
-   (use (match_operand:SI 3 "immediate_operand" "O,n"))
+   (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
    (use (reg:SI LR_REGNO))
    (return)]
   "(DEFAULT_ABI == ABI_DARWIN
-       || DEFAULT_ABI == ABI_V4)
+    || DEFAULT_ABI == ABI_V4)
    && (INTVAL (operands[3]) & CALL_LONG) == 0"
   "*
 {
-  if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
+  if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
     output_asm_insn (\"crxor 6,6,6\", operands);
 
-  else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
+  else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
     output_asm_insn (\"creqv 6,6,6\", operands);
 
-  if (DEFAULT_ABI == ABI_V4 && flag_pic)
+  if (which_alternative >= 2)
+    return \"b%T1\";
+  else if (DEFAULT_ABI == ABI_V4 && flag_pic)
     {
       gcc_assert (!TARGET_SECURE_PLT);
       return \"b %z1@plt\";
@@ -13092,8 +13071,8 @@ (define_insn "*sibcall_value_nonlocal_sy
   else
     return \"b %z1\";
 }"
-  [(set_attr "type" "branch,branch")
-   (set_attr "length" "4,8")])
+  [(set_attr "type" "branch")
+   (set_attr "length" "4,8,4,8")])
 
 (define_expand "sibcall_epilogue"
   [(use (const_int 0))]
Index: gcc/config/rs6000/darwin.md
===================================================================
--- gcc/config/rs6000/darwin.md	(revision 172094)
+++ gcc/config/rs6000/darwin.md	(working copy)
@@ -370,73 +370,3 @@ (define_insn "*call_value_nonlocal_darwi
 }
   [(set_attr "type" "branch,branch")
    (set_attr "length" "4,8")])
-
-(define_insn "*sibcall_nonlocal_darwin64"
-  [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s,s"))
-	 (match_operand 1 "" ""))
-   (use (match_operand 2 "immediate_operand" "O,n"))
-   (use (reg:SI 65))
-   (return)]
-  "(DEFAULT_ABI == ABI_DARWIN)
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
-{
-  return "b %z0";
-}
-  [(set_attr "type" "branch,branch")
-   (set_attr "length" "4,8")])
-
-(define_insn "*sibcall_value_nonlocal_darwin64"
-  [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s,s"))
-	      (match_operand 2 "" "")))
-   (use (match_operand:SI 3 "immediate_operand" "O,n"))
-   (use (reg:SI 65))
-   (return)]
-  "(DEFAULT_ABI == ABI_DARWIN)
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "*
-{
-  return \"b %z1\";
-}"
-  [(set_attr "type" "branch,branch")
-   (set_attr "length" "4,8")])
-
-
-(define_insn "*sibcall_symbolic_64"
-  [(call (mem:SI (match_operand:DI 0 "call_operand" "s,c")) ; 64
-	 (match_operand 1 "" ""))
-   (use (match_operand 2 "" ""))
-   (use (reg:SI 65))
-   (return)]
-  "TARGET_64BIT && DEFAULT_ABI == ABI_DARWIN"
-  "*
-{
-  switch (which_alternative)
-    {
-      case 0:  return \"b %z0\";
-      case 1:  return \"b%T0\";
-      default:  gcc_unreachable ();
-    }
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4")])
-
-(define_insn "*sibcall_value_symbolic_64"
-  [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:DI 1 "call_operand" "s,c"))
-	      (match_operand 2 "" "")))
-   (use (match_operand:SI 3 "" ""))
-   (use (reg:SI 65))
-   (return)]
-  "TARGET_64BIT && DEFAULT_ABI == ABI_DARWIN"
-  "*
-{
-  switch (which_alternative)
-    {
-      case 0:  return \"b %z1\";
-      case 1:  return \"b%T1\";
-      default:  gcc_unreachable ();
-    }
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4")])
Index: gcc/testsuite/gcc.target/powerpc/ppc-pow.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/ppc-pow.c	(revision 172094)
+++ gcc/testsuite/gcc.target/powerpc/ppc-pow.c	(working copy)
@@ -2,8 +2,8 @@
 /* { dg-options "-O2 -ffast-math -mcpu=power6" } */
 /* { dg-final { scan-assembler-times "fsqrt" 3 } } */
 /* { dg-final { scan-assembler-times "fmul" 1 } } */
-/* { dg-final { scan-assembler-times "bl pow" 1 } } */
-/* { dg-final { scan-assembler-times "bl sqrt" 1 } } */
+/* { dg-final { scan-assembler-times "bl? pow" 1 } } */
+/* { dg-final { scan-assembler-times "bl? sqrt" 1 } } */
 
 double
 do_pow_0_75_default (double a)

-- 
Alan Modra
Australia Development Lab, IBM

[-- Attachment #2: vec.c --]
[-- Type: text/x-csrc, Size: 788 bytes --]

#define vector __attribute__((vector_size(16)))

vector int v1;

extern void foo (int *, vector int *, vector int *, vector int *);

void f1 (void)
{
  int a = sizeof (v1);
  vector int v2;
  vector int *v3 = __builtin_alloca (sizeof (*v3));
  foo (&a, &v1, &v2, v3);
}

vector int f2 (int n, vector int x)
{
  if (n <= 1)
    return x;
  if (n & 1)
    return f2 (n >> 1, x + x);
  else
    return f2 (n >> 1, x);
}

vector int f3 (vector int x)
{
  return f2 (3, x);
}

extern vector int bar (vector int, vector int);

vector int f4 (vector int x)
{
  return bar (x, x);
}

extern vector int (*extv1) (vector int);

vector int f5 (vector int x)
{
  return (*extv1) (x);
}

extern vector int (*extv2) (vector int, vector int);

vector int f6 (vector int x)
{
  return (*extv2) (x, x);
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Allow more PowerPC sibling calls
  2011-04-09  2:52 Allow more PowerPC sibling calls Alan Modra
@ 2011-04-18 17:34 ` David Edelsohn
  2011-04-18 21:25   ` Mike Stump
  2011-04-18 17:37 ` Nathan Froyd
  1 sibling, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2011-04-18 17:34 UTC (permalink / raw)
  To: gcc-patches, dalej, mikestump, Alan Modra, Jack Howarth

On Fri, Apr 8, 2011 at 10:51 PM, Alan Modra <amodra@gmail.com> wrote:
> This patch enables sibling calls for powerpc in a few more cases, and
> fixes bugs exposed by that change.  We now
> a) Allow sibling calls via function pointer.  At the time
>   rs6000_function_ok_for_sibcall was written, I don't think access to
>   arg types of function pointer calls was available in the target
>   hook/macro.
> b) Allow sibling calls to functions with vector parameters.  Contrary
>   to the previous comment about vector parameters, a problem occurs
>   with VRSAVE only when the called function has more vector
>   parameters than the caller (because VRSAVE bits will already be set
>   for the caller's arguments).  Also, the old code did not make any
>   attempt to determine whether altivec/vsx registers would actually
>   be used to pass args.  Not all vector types fit in these regs.
> c) Allow SYSV4 ABI code to make sibling calls to non-local functions
>   so long as not both flag_pic and TARGET_SECURE_PLT are set.
>   The PIC -msecure-plt call stubs use r30.
>
> sibcall_value_nonlocal_sysv was trying to read the call cookie from
> the wrong operand, a latent bug since the pattern wasn't used until
> now.  I also fixed a minor problem with CALL_LIBCALL in the call
> cookie, which could cause various call insns to match an "n"
> constraint rather than a "0" constraint and so give the wrong insn
> length.  Bootstrapped and regression tested powerpc64-linux and
> powerpc-linux.
>
> This patch does affect darwin, not only in removing what are now
> redundant insn patterns, but also (a) and (b) above.  Would someone
> please run a bootstrap and regression test on darwin for me?  I don't
> have a machine handy to confirm that I didn't break anything there.
>
> I've attached a vector testcase I used to verify some of these
> changes.
>
> gcc/
>        * config/rs6000/rs6000.c (rs6000_function_arg): Remove CALL_LIBCALL
>        when returning call_cookie.
>        (rs6000_function_ok_for_sibcall): Allow sibcalls via function
>        pointers, to functions with no more vector args than the current
>        function, and some non-local calls for ABI_V4.
>        * config/rs6000/rs6000.md (sibcall_nonlocal_aix32,
>        sibcall_nonlocal_aix64): Combine to ..
>        (sibcall_nonlocal_aix<mode>): ..this.  Handle function pointer calls.
>        (sibcall_value_nonlocal_aix32, sibcall_value_nonlocal_aix64): Combine..
>        (sibcall_value_nonlocal_aix<mode>): ..likewise.
>        (*sibcall_nonlocal_sysv<mode>): Handle function pointer calls.
>        (sibcall_value_nonlocal_sysv<mode>): Likewise.  Correct call cookie
>        operand.
>        * config/rs6000/darwin.md (sibcall_nonlocal_darwin64,
>        sibcall_value_nonlocal_darwin64, sibcall_symbolic_64,
>        sibcall_value_symbolic_64): Delete.
> gcc/testsuite/
>        * gcc.target/powerpc/ppc-pow.c: Allow for tail calls.

This is okay.

It would be nice if someone tested on Darwin, although I am sure we
will hear soon enough if it broke anything.

Thanks, David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Allow more PowerPC sibling calls
  2011-04-09  2:52 Allow more PowerPC sibling calls Alan Modra
  2011-04-18 17:34 ` David Edelsohn
@ 2011-04-18 17:37 ` Nathan Froyd
  2011-04-22  5:00   ` Alan Modra
  1 sibling, 1 reply; 6+ messages in thread
From: Nathan Froyd @ 2011-04-18 17:37 UTC (permalink / raw)
  To: gcc-patches, David Edelsohn, dalej, mikestump

On Sat, Apr 09, 2011 at 12:21:46PM +0930, Alan Modra wrote:
> a) Allow sibling calls via function pointer.  At the time
>    rs6000_function_ok_for_sibcall was written, I don't think access to
>    arg types of function pointer calls was available in the target
>    hook/macro.
>
> +      /* Functions with vector parameters are required to have a
> +	 prototype, so the argument type info must be available
> +	 here.  */
> +      for (type = TYPE_ARG_TYPES (fntype);
> +	   type;
> +	   type = TREE_CHAIN (type))
> +	if (TREE_CODE (TREE_VALUE (type)) == VECTOR_TYPE
> +	    && (ALTIVEC_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))
> +		|| VSX_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))))
> +	  nvreg++;
> +
> +      for (type = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
> +	   type;
> +	   type = TREE_CHAIN (type))
> +	if (TREE_CODE (TREE_VALUE (type)) == VECTOR_TYPE
> +	    && (ALTIVEC_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))
> +		|| VSX_VECTOR_MODE (TYPE_MODE (TREE_VALUE (type)))))
> +	  nvreg--;

Could I request that you use FOREACH_FUNCTION_ARGS in these two cases?
The conversion is trivial, and avoiding more exposed TYPE_ARG_TYPES
calls is a good thing.

Thanks,
-Nathan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Allow more PowerPC sibling calls
  2011-04-18 17:34 ` David Edelsohn
@ 2011-04-18 21:25   ` Mike Stump
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 2011-04-18 21:25 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-patches, dalej, Alan Modra, Jack Howarth

On Apr 18, 2011, at 10:24 AM, David Edelsohn wrote:
>> This patch does affect darwin, not only in removing what are now
>> redundant insn patterns, but also (a) and (b) above.  Would someone
>> please run a bootstrap and regression test on darwin for me?  I don't
>> have a machine handy to confirm that I didn't break anything there.

> It would be nice if someone tested on Darwin, although I am sure we
> will hear soon enough if it broke anything.

I'm happy if you just want to check it in and then check Geoff's regression tester after 20 hours or whatever its cycle time is currently.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Allow more PowerPC sibling calls
  2011-04-18 17:37 ` Nathan Froyd
@ 2011-04-22  5:00   ` Alan Modra
  2011-04-22  6:13     ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2011-04-22  5:00 UTC (permalink / raw)
  To: Nathan Froyd; +Cc: gcc-patches, David Edelsohn, dalej, mikestump

On Mon, Apr 18, 2011 at 10:29:17AM -0700, Nathan Froyd wrote:
> Could I request that you use FOREACH_FUNCTION_ARGS in these two cases?
> The conversion is trivial, and avoiding more exposed TYPE_ARG_TYPES
> calls is a good thing.

Committed revision 172855.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Allow more PowerPC sibling calls
  2011-04-22  5:00   ` Alan Modra
@ 2011-04-22  6:13     ` Alan Modra
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Modra @ 2011-04-22  6:13 UTC (permalink / raw)
  To: Nathan Froyd, gcc-patches, David Edelsohn, dalej, mikestump

On Fri, Apr 22, 2011 at 01:29:14PM +0930, Alan Modra wrote:
> On Mon, Apr 18, 2011 at 10:29:17AM -0700, Nathan Froyd wrote:
> > Could I request that you use FOREACH_FUNCTION_ARGS in these two cases?
> > The conversion is trivial, and avoiding more exposed TYPE_ARG_TYPES
> > calls is a good thing.
> 
> Committed revision 172855.

Oops, I missed the following hunk, which I talked about here

> I also fixed a minor problem with CALL_LIBCALL in the call
> cookie, which could cause various call insns to match an "n"
> constraint rather than a "0" constraint and so give the wrong insn
> length.

and mentioned in the changelog:

>	* config/rs6000/rs6000.c (rs6000_function_arg): Remove CALL_LIBCALL
>	when returning call_cookie.

but failed to include in my post.  Committed as obvious, revision 172856.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 172855)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -9007,7 +9007,7 @@ rs6000_function_arg (CUMULATIVE_ARGS *cu
 			       : CALL_V4_CLEAR_FP_ARGS));
 	}
 
-      return GEN_INT (cum->call_cookie);
+      return GEN_INT (cum->call_cookie & ~CALL_LIBCALL);
     }
 
   if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))


-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-22  4:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-09  2:52 Allow more PowerPC sibling calls Alan Modra
2011-04-18 17:34 ` David Edelsohn
2011-04-18 21:25   ` Mike Stump
2011-04-18 17:37 ` Nathan Froyd
2011-04-22  5:00   ` Alan Modra
2011-04-22  6:13     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).