diff mbox

macroize some rs6000 call patterns

Message ID 20110401131218.GS23480@codesourcery.com
State New
Headers show

Commit Message

Nathan Froyd April 1, 2011, 1:12 p.m. UTC
This patch does as $SUBJECT suggests.  It doesn't macroize all the call insns,
as iterators don't support substituting CONST_INTs, but it does clean up
quite a bit.

Tested on powerpc64-unknown-linux-gnu.  OK to commit?

-Nathan

	* config/rs6000/rs6000.md (*call_local32): Rename to...
	(*call_local<mode>): ...this and combine with...
	(*call_local64): ...this using mode iterators.
	(*call_value_local32, *call_value_local<mode>,
	*call_value_local64): Likewise.
	(*call_nonlocal_aix32, *call_nonlocal_aix<mode>):
	(*call_nonlocal_aix64): Likewise.
	(*call_value_nonlocal_aix32, *call_value_nonlocal_aix<mode>):
	(*call_value_nonlocal_aix64): Likewise.
	(*sibcall_local32, *sibcall_local<mode>, *sibcall_local64):
	Likewise.
	(*sibcall_value_local32, *sibcall_value_local<mode>):
	(*sibcall_value_local64): Likewise.
	(*sibcall_nonlocal_aix32, *sibcall_nonlocal_aix<mode>):
	(*sibcall_nonlocal_aix64): Likewise.
	(*sibcall_value_nonlocal_aix32, *sibcall_value_nonlocal_aix<mode>):
	(*sibcall_value_nonlocal_aix64): Likewise.
diff mbox

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 21287c9..ba6ca01 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -11907,8 +11907,8 @@ 
 ;; variable argument function.  It is > 0 if FP registers were passed
 ;; and < 0 if they were not.
 
-(define_insn "*call_local32"
-  [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
+(define_insn "*call_local<mode>"
+  [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s,s"))
 	 (match_operand 1 "" "g,g"))
    (use (match_operand:SI 2 "immediate_operand" "O,n"))
    (clobber (reg:SI LR_REGNO))]
@@ -11926,28 +11926,9 @@ 
   [(set_attr "type" "branch")
    (set_attr "length" "4,8")])
 
-(define_insn "*call_local64"
-  [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
-	 (match_operand 1 "" "g,g"))
-   (use (match_operand:SI 2 "immediate_operand" "O,n"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4,8")])
-
-(define_insn "*call_value_local32"
+(define_insn "*call_value_local<mode>"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
+	(call (mem:SI (match_operand:P 1 "current_file_function_operand" "s,s"))
 	      (match_operand 2 "" "g,g")))
    (use (match_operand:SI 3 "immediate_operand" "O,n"))
    (clobber (reg:SI LR_REGNO))]
@@ -11965,27 +11946,6 @@ 
   [(set_attr "type" "branch")
    (set_attr "length" "4,8")])
 
-
-(define_insn "*call_value_local64"
-  [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
-	      (match_operand 2 "" "g,g")))
-   (use (match_operand:SI 3 "immediate_operand" "O,n"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4,8")])
-
 ;; Call to function which may be in another module.  Restore the TOC
 ;; pointer (r2) after the call unless this is System V.
 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
@@ -12029,13 +11989,12 @@ 
   [(set_attr "type" "jmpreg")
    (set_attr "length" "8")])
 
-(define_insn "*call_nonlocal_aix32"
-  [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
+(define_insn "*call_nonlocal_aix<mode>"
+  [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
 	 (match_operand 1 "" "g"))
    (use (match_operand:SI 2 "immediate_operand" "O"))
    (clobber (reg:SI LR_REGNO))]
-  "TARGET_32BIT
-   && DEFAULT_ABI == ABI_AIX
+  "DEFAULT_ABI == ABI_AIX
    && (INTVAL (operands[2]) & CALL_LONG) == 0"
   "bl %z0\;%."
   [(set_attr "type" "branch")
@@ -12078,18 +12037,6 @@ 
   [(set_attr "type" "jmpreg")
    (set_attr "length" "8")])
 
-(define_insn "*call_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"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT
-   && DEFAULT_ABI == ABI_AIX
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "bl %z0\;%."
-  [(set_attr "type" "branch")
-   (set_attr "length" "8")])
-
 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
   [(set (match_operand 0 "" "")
 	(call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
@@ -12129,14 +12076,13 @@ 
   [(set_attr "type" "jmpreg")
    (set_attr "length" "8")])
 
-(define_insn "*call_value_nonlocal_aix32"
+(define_insn "*call_value_nonlocal_aix<mode>"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
+	(call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
 	      (match_operand 2 "" "g")))
    (use (match_operand:SI 3 "immediate_operand" "O"))
    (clobber (reg:SI LR_REGNO))]
-  "TARGET_32BIT
-   && DEFAULT_ABI == ABI_AIX
+  "DEFAULT_ABI == ABI_AIX
    && (INTVAL (operands[3]) & CALL_LONG) == 0"
   "bl %z1\;%."
   [(set_attr "type" "branch")
@@ -12181,19 +12127,6 @@ 
   [(set_attr "type" "jmpreg")
    (set_attr "length" "8")])
 
-(define_insn "*call_value_nonlocal_aix64"
-  [(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"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT
-   && DEFAULT_ABI == ABI_AIX
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "bl %z1\;%."
-  [(set_attr "type" "branch")
-   (set_attr "length" "8")])
-
 ;; A function pointer under System V is just a normal pointer
 ;; operands[0] is the function pointer
 ;; operands[1] is the stack size to clean up
@@ -12428,8 +12361,8 @@ 
 ;; dataflow will try to delete the store into it.  This is true
 ;; even when the actual reg to jump to is in CTR, when LR was
 ;; saved and restored around the PIC-setting BCL.
-(define_insn "*sibcall_local32"
-  [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
+(define_insn "*sibcall_local<mode>"
+  [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s,s"))
 	 (match_operand 1 "" "g,g"))
    (use (match_operand:SI 2 "immediate_operand" "O,n"))
    (use (reg:SI LR_REGNO))
@@ -12448,29 +12381,9 @@ 
   [(set_attr "type" "branch")
    (set_attr "length" "4,8")])
 
-(define_insn "*sibcall_local64"
-  [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
-	 (match_operand 1 "" "g,g"))
-   (use (match_operand:SI 2 "immediate_operand" "O,n"))
-   (use (reg:SI LR_REGNO))
-   (return)]
-  "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4,8")])
-
-(define_insn "*sibcall_value_local32"
+(define_insn "*sibcall_value_local<mode>"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
+	(call (mem:SI (match_operand:P 1 "current_file_function_operand" "s,s"))
 	      (match_operand 2 "" "g,g")))
    (use (match_operand:SI 3 "immediate_operand" "O,n"))
    (use (reg:SI LR_REGNO))
@@ -12489,77 +12402,26 @@ 
   [(set_attr "type" "branch")
    (set_attr "length" "4,8")])
 
-
-(define_insn "*sibcall_value_local64"
-  [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
-	      (match_operand 2 "" "g,g")))
-   (use (match_operand:SI 3 "immediate_operand" "O,n"))
-   (use (reg:SI LR_REGNO))
-   (return)]
-  "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
-}"
-  [(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"))
-   (use (reg:SI LR_REGNO))
-   (return)]
-  "TARGET_32BIT
-   && 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"))
+(define_insn "*sibcall_nonlocal_aix<mode>"
+  [(call (mem:SI (match_operand:P 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
+  "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"
-  [(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"))
+	(call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
 	      (match_operand 2 "" "g")))
    (use (match_operand:SI 3 "immediate_operand" "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"
   [(set_attr "type" "branch")