]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/24779 (Python miscompilation - TOC reload)
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Fri, 12 Dec 2008 22:54:09 +0000 (14:54 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 12 Dec 2008 22:54:09 +0000 (14:54 -0800)
2008-12-12  Andrew Pinski  <andrew_pinskia@playstation.sony.com>
            Peter Bergner <bergner@vnet.ibm.com>

        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.

Co-Authored-By: Peter Bergner <bergner@vnet.ibm.com>
From-SVN: r142727

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 585f102b6218001cd9196691ec6493afa48af484..f25094f8a121a97b4ea87cbd101c35c5cd8898ca 100644 (file)
@@ -1,3 +1,25 @@
+2008-12-12  Andrew Pinski  <andrew_pinskia@playstation.sony.com>
+            Peter Bergner <bergner@vnet.ibm.com>
+
+       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.
+
 2008-12-12  Andreas Schwab  <schwab@suse.de>
 
        Revert:
index b1df32aa17cab8d785588818f0d138c90af7ad75..7a6c0369065a01e9c07ddb393834342de3f31a0f 100644 (file)
        (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"
   "
        (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"
   "
        (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"
   "
        (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"
   "
 ;; 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"))
    (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")])
   "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"))
    (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")])
   [(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"))
    (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")])
   [(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"))
    (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")])