File nvl428413.patch of Package gcc43
Here is a backported patch (just removes fuzz) of Andrew's mainline patch which
is posted here:
http://gcc.gnu.org/ml/gcc-patches/2008-12/msg00690.html
PR target/24779
* config/rs6000/rs6000.md (call_indirect_aix32): Move the load of the
TOC into the call pattern.
(call_indirect_aix64): Likewise.
(call_value_indirect_aix32): Likewise.
(call_value_indirect_aix64): Likewise.
(call_indirect_nonlocal_aix32_internal): New insn and split patterns
to split off the load of the TOC.
(call_indirect_nonlocal_aix32): Enable only after reload.
(call_indirect_nonlocal_aix64_internal): New insn and split patterns
to split off the load of the TOC.
(call_indirect_nonlocal_aix64): Enable only after reload.
(call_value_indirect_nonlocal_aix32_internal): New insn and split
patterns to split off the load of the TOC.
(call_value_indirect_nonlocal_aix32): Enable only after reload.
(call_value_indirect_nonlocal_aix64_internal): New insn and split
patterns to split off the load of the TOC.
(call_value_indirect_nonlocal_aix64): Enable only after reload.
--- gcc/config/rs6000/rs6000.md.orig 2008-10-23 11:08:58.000000000 -0500
+++ gcc/config/rs6000/rs6000.md 2008-12-07 21:52:23.000000000 -0600
@@ -10667,18 +10667,14 @@
(mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
(set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
(reg:SI 2))
- (set (reg:SI 2)
- (mem:SI (plus:SI (match_dup 0)
- (const_int 4))))
(set (reg:SI 11)
(mem:SI (plus:SI (match_dup 0)
(const_int 8))))
(parallel [(call (mem:SI (match_dup 2))
(match_operand 1 "" ""))
- (use (reg:SI 2))
+ (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
(use (reg:SI 11))
- (set (reg:SI 2)
- (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
(clobber (reg:SI LR_REGNO))])]
"TARGET_32BIT"
"
@@ -10689,18 +10685,14 @@
(mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
(set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
(reg:DI 2))
- (set (reg:DI 2)
- (mem:DI (plus:DI (match_dup 0)
- (const_int 8))))
(set (reg:DI 11)
(mem:DI (plus:DI (match_dup 0)
(const_int 16))))
(parallel [(call (mem:SI (match_dup 2))
(match_operand 1 "" ""))
- (use (reg:DI 2))
+ (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
(use (reg:DI 11))
- (set (reg:DI 2)
- (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
(clobber (reg:SI LR_REGNO))])]
"TARGET_64BIT"
"
@@ -10711,19 +10703,15 @@
(mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
(set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
(reg:SI 2))
- (set (reg:SI 2)
- (mem:SI (plus:SI (match_dup 1)
- (const_int 4))))
(set (reg:SI 11)
(mem:SI (plus:SI (match_dup 1)
(const_int 8))))
(parallel [(set (match_operand 0 "" "")
(call (mem:SI (match_dup 3))
(match_operand 2 "" "")))
- (use (reg:SI 2))
+ (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
(use (reg:SI 11))
- (set (reg:SI 2)
- (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
(clobber (reg:SI LR_REGNO))])]
"TARGET_32BIT"
"
@@ -10734,19 +10722,15 @@
(mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
(set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
(reg:DI 2))
- (set (reg:DI 2)
- (mem:DI (plus:DI (match_dup 1)
- (const_int 8))))
(set (reg:DI 11)
(mem:DI (plus:DI (match_dup 1)
(const_int 16))))
(parallel [(set (match_operand 0 "" "")
(call (mem:SI (match_dup 3))
(match_operand 2 "" "")))
- (use (reg:DI 2))
+ (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
(use (reg:DI 11))
- (set (reg:DI 2)
- (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
(clobber (reg:SI LR_REGNO))])]
"TARGET_64BIT"
"
@@ -10948,6 +10932,29 @@
;; variable argument function. It is > 0 if FP registers were passed
;; and < 0 if they were not.
+(define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
+ [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
+ (match_operand 1 "" "g,g"))
+ (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
+ (use (reg:SI 11))
+ (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (clobber (reg:SI LR_REGNO))]
+ "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 2)
+ (mem:SI (plus:SI (match_dup 2) (const_int 4))))
+ (parallel [(call (mem:SI (match_dup 0))
+ (match_dup 1))
+ (use (reg:SI 2))
+ (use (reg:SI 11))
+ (set (reg:SI 2)
+ (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (clobber (reg:SI LR_REGNO))])]
+ ""
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
(define_insn "*call_indirect_nonlocal_aix32"
[(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
(match_operand 1 "" "g,g"))
@@ -10956,7 +10963,7 @@
(set (reg:SI 2)
(mem:SI (plus:SI (reg:SI 1) (const_int 20))))
(clobber (reg:SI LR_REGNO))]
- "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
+ "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
"b%T0l\;{l|lwz} 2,20(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
@@ -10972,6 +10979,30 @@
"bl %z0\;%."
[(set_attr "type" "branch")
(set_attr "length" "8")])
+
+(define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
+ [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
+ (match_operand 1 "" "g,g"))
+ (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
+ (const_int 8))))
+ (use (reg:DI 11))
+ (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (clobber (reg:SI LR_REGNO))]
+ "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
+ "#"
+ "&& reload_completed"
+ [(set (reg:DI 2)
+ (mem:DI (plus:DI (match_dup 2) (const_int 8))))
+ (parallel [(call (mem:SI (match_dup 0))
+ (match_dup 1))
+ (use (reg:DI 2))
+ (use (reg:DI 11))
+ (set (reg:DI 2)
+ (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (clobber (reg:SI LR_REGNO))])]
+ ""
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
(define_insn "*call_indirect_nonlocal_aix64"
[(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
@@ -10981,7 +11012,7 @@
(set (reg:DI 2)
(mem:DI (plus:DI (reg:DI 1) (const_int 40))))
(clobber (reg:SI LR_REGNO))]
- "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
+ "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
"b%T0l\;ld 2,40(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
@@ -10998,6 +11029,31 @@
[(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"))
+ (match_operand 2 "" "g,g")))
+ (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
+ (const_int 4))))
+ (use (reg:SI 11))
+ (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (clobber (reg:SI LR_REGNO))]
+ "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 2)
+ (mem:SI (plus:SI (match_dup 3) (const_int 4))))
+ (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
+ (match_dup 2)))
+ (use (reg:SI 2))
+ (use (reg:SI 11))
+ (set (reg:SI 2)
+ (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
+ (clobber (reg:SI LR_REGNO))])]
+ ""
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
(define_insn "*call_value_indirect_nonlocal_aix32"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
@@ -11007,7 +11063,7 @@
(set (reg:SI 2)
(mem:SI (plus:SI (reg:SI 1) (const_int 20))))
(clobber (reg:SI LR_REGNO))]
- "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
+ "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
"b%T1l\;{l|lwz} 2,20(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
@@ -11025,6 +11081,31 @@
[(set_attr "type" "branch")
(set_attr "length" "8")])
+(define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
+ [(set (match_operand 0 "" "")
+ (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
+ (match_operand 2 "" "g,g")))
+ (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
+ (const_int 8))))
+ (use (reg:DI 11))
+ (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (clobber (reg:SI LR_REGNO))]
+ "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
+ "#"
+ "&& reload_completed"
+ [(set (reg:DI 2)
+ (mem:DI (plus:DI (match_dup 3) (const_int 8))))
+ (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
+ (match_dup 2)))
+ (use (reg:DI 2))
+ (use (reg:DI 11))
+ (set (reg:DI 2)
+ (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
+ (clobber (reg:SI LR_REGNO))])]
+ ""
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
(define_insn "*call_value_indirect_nonlocal_aix64"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
@@ -11034,7 +11115,7 @@
(set (reg:DI 2)
(mem:DI (plus:DI (reg:DI 1) (const_int 40))))
(clobber (reg:SI LR_REGNO))]
- "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
+ "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
"b%T1l\;ld 2,40(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])