public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Subject: [Darwin, PPC, Mode Iterators 1/n, committed] Use mode iterators in picbase patterns.
Date: Tue, 24 Sep 2019 19:31:00 -0000	[thread overview]
Message-ID: <AB07FABB-DCA8-4813-8E21-95040505E6CD@sandoe.co.uk> (raw)

This switches the picbase load and reload patterns to use the 'P' mode
iterator instead of writing an SI and DI pattern for each (and deletes the
old patterns).  No functional change intended.

Tested on powerpc-darwin9, powerpc64-linux-gnu,
applied to mainline
thanks
Iain

gcc/ChangeLog:

2019-09-24  Iain Sandoe  <iain@sandoe.co.uk>

	* config/rs6000/rs6000.md (load_macho_picbase_<mode>): New, using
	the 'P' mode iterator, replacing the (removed) SI and DI variants.
	(reload_macho_picbase_<mode>): Likewise.

diff --git a/gcc/config/rs6000/darwin.md b/gcc/config/rs6000/darwin.md
index 471058dd41..4a284211af 100644
--- a/gcc/config/rs6000/darwin.md
+++ b/gcc/config/rs6000/darwin.md
@@ -217,7 +217,7 @@ You should have received a copy of the GNU General Public License
   "")
 
 (define_expand "load_macho_picbase"
-  [(set (reg:SI LR_REGNO)
+  [(set (reg LR_REGNO)
         (unspec [(match_operand 0 "")]
                    UNSPEC_LD_MPIC))]
   "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
@@ -230,9 +230,9 @@ You should have received a copy of the GNU General Public License
   DONE;
 })
 
-(define_insn "load_macho_picbase_si"
-  [(set (reg:SI LR_REGNO)
-       (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
+(define_insn "load_macho_picbase_<mode>"
+  [(set (reg:P LR_REGNO)
+       (unspec:P [(match_operand:P 0 "immediate_operand" "s")
                    (pc)] UNSPEC_LD_MPIC))]
   "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
 {
@@ -246,22 +246,6 @@ You should have received a copy of the GNU General Public License
   [(set_attr "type" "branch")
    (set_attr "cannot_copy" "yes")])
 
-(define_insn "load_macho_picbase_di"
-  [(set (reg:DI LR_REGNO)
-       (unspec:DI [(match_operand:DI 0 "immediate_operand" "s")
-                   (pc)] UNSPEC_LD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic && TARGET_64BIT"
-{
-#if TARGET_MACHO
-  machopic_should_output_picbase_label (); /* Update for new func.  */
-#else
-  gcc_unreachable ();
-#endif
-  return "bcl 20,31,%0\n%0:";
-}
-  [(set_attr "type" "branch")
-   (set_attr "cannot_copy" "yes")])
-
 (define_expand "macho_correct_pic"
   [(set (match_operand 0 "")
        (plus (match_operand 1 "")
@@ -301,7 +285,7 @@ You should have received a copy of the GNU General Public License
   [(set_attr "length" "8")])
 
 (define_expand "reload_macho_picbase"
-  [(set (reg:SI LR_REGNO)
+  [(set (reg LR_REGNO)
         (unspec [(match_operand 0 "")]
                    UNSPEC_RELD_MPIC))]
   "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
@@ -314,9 +298,9 @@ You should have received a copy of the GNU General Public License
   DONE;
 })
 
-(define_insn "reload_macho_picbase_si"
-  [(set (reg:SI LR_REGNO)
-        (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
+(define_insn "reload_macho_picbase_<mode>"
+  [(set (reg:P LR_REGNO)
+        (unspec:P [(match_operand:P 0 "immediate_operand" "s")
                    (pc)] UNSPEC_RELD_MPIC))]
   "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
 {
@@ -337,29 +321,6 @@ You should have received a copy of the GNU General Public License
   [(set_attr "type" "branch")
    (set_attr "cannot_copy" "yes")])
 
-(define_insn "reload_macho_picbase_di"
-  [(set (reg:DI LR_REGNO)
-       (unspec:DI [(match_operand:DI 0 "immediate_operand" "s")
-                   (pc)] UNSPEC_RELD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic && TARGET_64BIT"
-{
-#if TARGET_MACHO
-  if (machopic_should_output_picbase_label ())
-    {
-      static char tmp[64];
-      const char *cnam = machopic_get_function_picbase ();
-      snprintf (tmp, 64, "bcl 20,31,%s\n%s:\n%%0:", cnam, cnam);
-      return tmp;
-    }
-  else
-#else
-  gcc_unreachable ();
-#endif
-    return "bcl 20,31,%0\n%0:";
-}
-  [(set_attr "type" "branch")
-   (set_attr "cannot_copy" "yes")])
-
 ;; We need to restore the PIC register, at the site of nonlocal label.
 
 (define_insn_and_split "nonlocal_goto_receiver"

             reply	other threads:[~2019-09-24 19:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 19:31 Iain Sandoe [this message]
2019-09-24 23:23 ` Segher Boessenkool
2019-09-26 18:57   ` [Darwin, PPC, Mode Iterators 2/n] Eliminate picbase expanders Iain Sandoe
2019-09-27 19:29     ` [Darwin, PPC, Mode Iterators 3/n, committed] Update macho_correct_pic Iain Sandoe
2019-09-28 19:36       ` [Darwin, PPC, Mode Iterators 4/n, committed] Update macho_high Iain Sandoe
2019-09-29 20:59         ` [Darwin, PPC, Mode Iterators 5/n, committed] Update macho_low Iain Sandoe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AB07FABB-DCA8-4813-8E21-95040505E6CD@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).