diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c65c31a1bd..347d74e2086 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2011-09-19 Alan Modra + Michael Meissner + + PR target/50341 + * config/rs6000/rs6000.md (call_indirect_aix): Do not + split the load of the indirect function's TOC from the call to + prevent the compiler from moving the load of the new TOC above + code that references the current function's TOC. + (call_indirect_aix_internal): Ditto. + (call_indirect_aix_nor11): Ditto. + (call_indirect_aix_internal2): Ditto. + (call_value_indirect_aix): Ditto. + (call_value_indirect_aix_internal): Ditto. + (call_value_indirect_aix_nor11): Ditto. + (call_value_indirect_aix_internal2): Ditto. + 2011-09-19 Jakub Jelinek * config/i386/sse.md (*sse4_1_extractps): Change into diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 3db67a53248..a2e6fdc2b20 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12379,169 +12379,73 @@ ;; Operand2 is the location in the function descriptor to load r2 from ;; Operand3 is the stack location to hold the current TOC pointer -(define_insn_and_split "call_indirect_aix" +(define_insn "call_indirect_aix" [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) (match_operand 1 "" "g,g")) (use (match_operand:P 2 "memory_operand" "m,m")) - (use (match_operand:P 3 "memory_operand" "m,m")) + (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m")) (use (reg:P STATIC_CHAIN_REGNUM)) (clobber (reg:P LR_REGNO))] "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "#" - "&& reload_completed" - [(set (reg:P TOC_REGNUM) (match_dup 2)) - (parallel [(call (mem:SI (match_dup 0)) - (match_dup 1)) - (use (reg:P TOC_REGNUM)) - (use (reg:P STATIC_CHAIN_REGNUM)) - (use (match_dup 3)) - (set (reg:P TOC_REGNUM) (match_dup 3)) - (clobber (reg:P LR_REGNO))])] - "" + " 2,%2\;b%T0l\; 2,%3" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) -(define_insn "*call_indirect_aix_internal" - [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) - (match_operand 1 "" "g,g")) - (use (reg:P TOC_REGNUM)) - (use (reg:P STATIC_CHAIN_REGNUM)) - (use (match_operand:P 2 "memory_operand" "m,m")) - (set (reg:P TOC_REGNUM) (match_dup 2)) - (clobber (reg:P LR_REGNO))] - "DEFAULT_ABI == ABI_AIX && reload_completed - && TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "b%T0l\; 2,%2" - [(set_attr "type" "jmpreg") - (set_attr "length" "8")]) - -;; Like call_indirect_aix, except don't load the static chain +;; Like call_indirect_aix, but no use of the static chain ;; Operand0 is the addresss of the function to call ;; Operand1 is the flag for System V.4 for unprototyped or FP registers ;; Operand2 is the location in the function descriptor to load r2 from ;; Operand3 is the stack location to hold the current TOC pointer -(define_insn_and_split "call_indirect_aix_nor11" +(define_insn "call_indirect_aix_nor11" [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) (match_operand 1 "" "g,g")) (use (match_operand:P 2 "memory_operand" "m,m")) - (use (match_operand:P 3 "memory_operand" "m,m")) + (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "m,m")) (clobber (reg:P LR_REGNO))] "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "#" - "&& reload_completed" - [(set (reg:P TOC_REGNUM) (match_dup 2)) - (parallel [(call (mem:SI (match_dup 0)) - (match_dup 1)) - (use (reg:P TOC_REGNUM)) - (use (match_dup 3)) - (set (reg:P TOC_REGNUM) (match_dup 3)) - (clobber (reg:P LR_REGNO))])] - "" + " 2,%2\;b%T0l\; 2,%3" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) -(define_insn "*call_indirect_aix_internal2" - [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) - (match_operand 1 "" "g,g")) - (use (reg:P TOC_REGNUM)) - (use (match_operand:P 2 "memory_operand" "m,m")) - (set (reg:P TOC_REGNUM) (match_dup 2)) - (clobber (reg:P LR_REGNO))] - "DEFAULT_ABI == ABI_AIX && reload_completed - && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "b%T0l\; 2,%2" - [(set_attr "type" "jmpreg") - (set_attr "length" "8")]) - ;; Operand0 is the return result of the function ;; Operand1 is the addresss of the function to call ;; Operand2 is the flag for System V.4 for unprototyped or FP registers ;; Operand3 is the location in the function descriptor to load r2 from ;; Operand4 is the stack location to hold the current TOC pointer -(define_insn_and_split "call_value_indirect_aix" +(define_insn "call_value_indirect_aix" [(set (match_operand 0 "" "") (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) (match_operand 2 "" "g,g"))) (use (match_operand:P 3 "memory_operand" "m,m")) - (use (match_operand:P 4 "memory_operand" "m,m")) + (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m")) (use (reg:P STATIC_CHAIN_REGNUM)) (clobber (reg:P LR_REGNO))] "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "#" - "&& reload_completed" - [(set (reg:P TOC_REGNUM) (match_dup 3)) - (parallel [(set (match_dup 0) - (call (mem:SI (match_dup 1)) - (match_dup 2))) - (use (reg:P TOC_REGNUM)) - (use (reg:P STATIC_CHAIN_REGNUM)) - (use (match_dup 4)) - (set (reg:P TOC_REGNUM) (match_dup 4)) - (clobber (reg:P LR_REGNO))])] - "" + " 2,%3\;b%T1l\; 2,%4" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) -(define_insn "*call_value_indirect_aix_internal" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) - (match_operand 2 "" "g,g"))) - (use (reg:P TOC_REGNUM)) - (use (reg:P STATIC_CHAIN_REGNUM)) - (use (match_operand:P 3 "memory_operand" "m,m")) - (set (reg:P TOC_REGNUM) (match_dup 3)) - (clobber (reg:P LR_REGNO))] - "DEFAULT_ABI == ABI_AIX && reload_completed - && TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "b%T1l\; 2,%3" - [(set_attr "type" "jmpreg") - (set_attr "length" "8")]) - -;; Like call_value_indirect_aix, but don't load the static chain +;; Like call_value_indirect_aix, but no use of the static chain ;; Operand0 is the return result of the function ;; Operand1 is the addresss of the function to call ;; Operand2 is the flag for System V.4 for unprototyped or FP registers ;; Operand3 is the location in the function descriptor to load r2 from ;; Operand4 is the stack location to hold the current TOC pointer -(define_insn_and_split "call_value_indirect_aix_nor11" +(define_insn "call_value_indirect_aix_nor11" [(set (match_operand 0 "" "") (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) (match_operand 2 "" "g,g"))) (use (match_operand:P 3 "memory_operand" "m,m")) - (use (match_operand:P 4 "memory_operand" "m,m")) + (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "m,m")) (clobber (reg:P LR_REGNO))] "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "#" - "&& reload_completed" - [(set (reg:P TOC_REGNUM) (match_dup 3)) - (parallel [(set (match_dup 0) - (call (mem:SI (match_dup 1)) - (match_dup 2))) - (use (reg:P TOC_REGNUM)) - (use (match_dup 4)) - (set (reg:P TOC_REGNUM) (match_dup 4)) - (clobber (reg:P LR_REGNO))])] - "" + " 2,%3\;b%T1l\; 2,%4" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) -(define_insn "*call_value_indirect_aix_internal2" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) - (match_operand 2 "" "g,g"))) - (use (reg:P TOC_REGNUM)) - (use (match_operand:P 3 "memory_operand" "m,m")) - (set (reg:P TOC_REGNUM) (match_dup 3)) - (clobber (reg:P LR_REGNO))] - "DEFAULT_ABI == ABI_AIX && reload_completed - && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" - "b%T1l\; 2,%3" - [(set_attr "type" "jmpreg") - (set_attr "length" "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