]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/rs6000/darwin.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / rs6000 / darwin.md
index 471058dd417756acf44071cb56314355f1a65ebc..05948c892024a0ba50f0bc67014afbd23e842e70 100644 (file)
@@ -1,5 +1,5 @@
 /* Machine description patterns for PowerPC running Darwin (Mac OS X).
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
+   Copyright (C) 2004-2020 Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
 This file is part of GCC.
@@ -122,87 +122,20 @@ You should have received a copy of the GNU General Public License
   [(set_attr "type" "store")])
 
 ;; 64-bit MachO load/store support
-(define_insn "movdi_low"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=r,*!d")
-        (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
-                           (match_operand 2 "" ""))))]
-  "TARGET_MACHO && TARGET_64BIT"
-  "@
-   ld %0,lo16(%2)(%1)
-   lfd %0,lo16(%2)(%1)"
-  [(set_attr "type" "load")])
-
-(define_insn "movsi_low_st"
-  [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
-                           (match_operand 2 "" "")))
-       (match_operand:SI 0 "gpc_reg_operand" "r"))]
-  "TARGET_MACHO && ! TARGET_64BIT"
-  "stw %0,lo16(%2)(%1)"
-  [(set_attr "type" "store")])
-
-(define_insn "movdi_low_st"
-  [(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
-                           (match_operand 2 "" "")))
-       (match_operand:DI 0 "gpc_reg_operand" "r,*!d"))]
-  "TARGET_MACHO && TARGET_64BIT"
-  "@
-   std %0,lo16(%2)(%1)
-   stfd %0,lo16(%2)(%1)"
-  [(set_attr "type" "store")])
 
-;; Mach-O PIC trickery.
-(define_expand "macho_high"
-  [(set (match_operand 0 "")
-       (high (match_operand 1 "")))]
-  "TARGET_MACHO"
-{
-  if (TARGET_64BIT)
-    emit_insn (gen_macho_high_di (operands[0], operands[1]));
-  else
-    emit_insn (gen_macho_high_si (operands[0], operands[1]));
-
-  DONE;
-})
-
-(define_insn "macho_high_si"
-  [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
-       (high:SI (match_operand 1 "" "")))]
-  "TARGET_MACHO && ! TARGET_64BIT"
-  "lis %0,ha16(%1)")
-  
+;; Mach-O PIC.
 
-(define_insn "macho_high_di"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
-       (high:DI (match_operand 1 "" "")))]
-  "TARGET_MACHO && TARGET_64BIT"
+(define_insn "@macho_high_<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
+       (high:P (match_operand 1 "" "")))]
+  "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN)"
   "lis %0,ha16(%1)")
 
-(define_expand "macho_low"
-  [(set (match_operand 0 "")
-       (lo_sum (match_operand 1 "")
-                  (match_operand 2 "")))]
-   "TARGET_MACHO"
-{
-  if (TARGET_64BIT)
-    emit_insn (gen_macho_low_di (operands[0], operands[1], operands[2]));
-  else
-    emit_insn (gen_macho_low_si (operands[0], operands[1], operands[2]));
-
-  DONE;
-})
-
-(define_insn "macho_low_si"
-  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
-       (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
-                  (match_operand 2 "" "")))]
-   "TARGET_MACHO && ! TARGET_64BIT"
-   "la %0,lo16(%2)(%1)")
-
-(define_insn "macho_low_di"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
-       (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
+(define_insn "@macho_low_<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
                   (match_operand 2 "" "")))]
-   "TARGET_MACHO && TARGET_64BIT"
+   "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN)"
    "la %0,lo16(%2)(%1)")
 
 (define_split
@@ -216,132 +149,37 @@ You should have received a copy of the GNU General Public License
        (match_dup 2))]
   "")
 
-(define_expand "load_macho_picbase"
-  [(set (reg:SI LR_REGNO)
-        (unspec [(match_operand 0 "")]
-                   UNSPEC_LD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
-{
-  if (TARGET_32BIT)
-    emit_insn (gen_load_macho_picbase_si (operands[0]));
-  else
-    emit_insn (gen_load_macho_picbase_di (operands[0]));
-
-  DONE;
-})
-
-(define_insn "load_macho_picbase_si"
-  [(set (reg:SI LR_REGNO)
-       (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
-                   (pc)] UNSPEC_LD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
-{
-#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_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 "")
-                (unspec [(match_operand 2 "")
-                            (match_operand 3 "")]
+(define_insn "@macho_correct_pic_<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (plus:P (match_operand:P 1 "gpc_reg_operand" "r")
+                (unspec:P [(match_operand:P 2 "immediate_operand" "s")
+                            (match_operand:P 3 "immediate_operand" "s")]
                            UNSPEC_MPIC_CORRECT)))]
   "DEFAULT_ABI == ABI_DARWIN"
-{
-  if (TARGET_32BIT)
-    emit_insn (gen_macho_correct_pic_si (operands[0], operands[1], operands[2],
-              operands[3]));
-  else
-    emit_insn (gen_macho_correct_pic_di (operands[0], operands[1], operands[2],
-              operands[3]));
-
-  DONE;
-})
-
-(define_insn "macho_correct_pic_si"
-  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
-       (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
-                (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
-                            (match_operand:SI 3 "immediate_operand" "s")]
-                           UNSPEC_MPIC_CORRECT)))]
-  "DEFAULT_ABI == ABI_DARWIN"
-  "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
-  [(set_attr "length" "8")])
-
-(define_insn "macho_correct_pic_di"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
-       (plus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
-                (unspec:DI [(match_operand:DI 2 "immediate_operand" "s")
-                            (match_operand:DI 3 "immediate_operand" "s")]
-                           16)))]
-  "DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT"
   "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
   [(set_attr "length" "8")])
 
-(define_expand "reload_macho_picbase"
-  [(set (reg:SI LR_REGNO)
-        (unspec [(match_operand 0 "")]
-                   UNSPEC_RELD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
-{
-  if (TARGET_32BIT)
-    emit_insn (gen_reload_macho_picbase_si (operands[0]));
-  else
-    emit_insn (gen_reload_macho_picbase_di (operands[0]));
-
-  DONE;
-})
-
-(define_insn "reload_macho_picbase_si"
-  [(set (reg:SI LR_REGNO)
-        (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
-                   (pc)] UNSPEC_RELD_MPIC))]
+(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"
 {
 #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
+  machopic_should_output_picbase_label (); /* Update for new func.  */
 #else
   gcc_unreachable ();
 #endif
-    return "bcl 20,31,%0\n%0:";
+  return "bcl 20,31,%0\n%0:";
 }
   [(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")
+(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 && TARGET_64BIT"
+  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
 {
 #if TARGET_MACHO
   if (machopic_should_output_picbase_label ())
@@ -381,9 +219,10 @@ You should have received a copy of the GNU General Public License
       ASM_GENERATE_INTERNAL_LABEL(tmplab, "Lnlgr", ++n);
       tmplrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
 
-      emit_insn (gen_reload_macho_picbase (tmplrtx));
+      emit_insn (gen_reload_macho_picbase (Pmode, tmplrtx));
       emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
-      emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplrtx));
+      emit_insn (gen_macho_correct_pic (Pmode, picreg, picreg,
+                                       picrtx, tmplrtx));
     }
   else
     /* Not using PIC reg, no reload needed.  */