https://gcc.gnu.org/g:374cc9624abe4af886b159a2a0beefdc27cbac40

commit 374cc9624abe4af886b159a2a0beefdc27cbac40
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Fri Apr 12 19:05:11 2024 -0400

    Add support for -mtar
    
    2024-04-12  Michael Meissner  <meiss...@linux.ibm.com>
    
    gcc/
    
            * config/rs6000/constraints.md (h constraint): Add tar register to
            documentation.
            (wt constraint): New constraint.
            * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Add -mtar.
            (POWERPC_MASKS): Likewise.
            * config/rs6000/rs6000.cc (rs6000_reg_names): Add new tar register.
            (alt_reg_names): Likewise.
            (rs6000_debug_reg_global): Likewise.
            (rs6000_init_hard_regno_mode_ok): Likewise.
            (rs6000_option_override_internal): Likewise.
            (rs6000_conditional_register_usage): Likewise.
            (print_operand): Likewise.
            (rs6000_debugger_regno): Likewise.
            (rs6000_opt_masks): Likewise.
            * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTER): Likewise.
            (FiXED_REGISTERS): Likewise.
            (CALL_REALLY_USED_REGISTERS): Likewise.
            (REG_ALLOC_ORDER): Likewise.
            (reg_class): Add new TAR_REGS register class.
            (REG_CLASS_NAMES): Likewise.
            (REG_CLASS_CONTENTS): Likewise.
            (r6000_reg_class_enum): Add RS6000_CONSTRAINT_wt.
            (REG_NAMES): Add tar register.
            * config/rs6000/rs6000.md (TAR_REGNO): New constant.
            (movcc_<mode>): Add support for tar register.
            (movsf_hardfloat): Likewise.
            (movsf_hardfloat): Likewise.
            (mov<mode>_softfloat): Likewise.
            (mov<mode>_hardfloat64): Likewise.
            (mov<mode>_softfloat6): Likewise.
            (indirect_jump): Likewise.
            (@indirect_jump<mode>_nospec): Likewise.
            (@tablejump<mode>_absolute): Likewise.
            (@tablejump<mode>_insn_nospec): Likewise.
            (<bd>_<mode>): Likewise.
            (<bd>tf_<mode>): Likewise.
            * config/rs6000/rs6000.opt (-mtar): New option.
            * doc/invoke.texi (RS/6000 options): Document -mtar.

Diff:
---
 gcc/config/rs6000/constraints.md  |  5 ++++-
 gcc/config/rs6000/rs6000-cpus.def |  4 +++-
 gcc/config/rs6000/rs6000.cc       | 36 +++++++++++++++++++++++++++++++-----
 gcc/config/rs6000/rs6000.h        | 31 +++++++++++++++++++------------
 gcc/config/rs6000/rs6000.md       | 31 ++++++++++++++++---------------
 gcc/config/rs6000/rs6000.opt      |  4 ++++
 gcc/doc/invoke.texi               | 12 ++++++++++--
 7 files changed, 87 insertions(+), 36 deletions(-)

diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md
index 369a7b75042..14f0465d7ae 100644
--- a/gcc/config/rs6000/constraints.md
+++ b/gcc/config/rs6000/constraints.md
@@ -57,7 +57,7 @@
   "@internal A compatibility alias for @code{wa}.")
 
 (define_register_constraint "h" "SPECIAL_REGS"
-  "@internal A special register (@code{vrsave}, @code{ctr}, or @code{lr}).")
+  "@internal A special register (@code{vrsave}, @code{ctr}, @code{lr} or 
@code{tar}).")
 
 (define_register_constraint "c" "CTR_REGS"
   "The count register, @code{ctr}.")
@@ -91,6 +91,9 @@
   "@internal Like @code{r}, if @option{-mpowerpc64} is used; otherwise,
    @code{NO_REGS}.")
 
+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
+  "The tar register, @code{tar}.")
+
 (define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
   "@internal Like @code{d}, if @option{-mpowerpc-gfxopt} is used; otherwise,
    @code{NO_REGS}.")
diff --git a/gcc/config/rs6000/rs6000-cpus.def 
b/gcc/config/rs6000/rs6000-cpus.def
index 47365534af8..7ea3ce09c8d 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -52,7 +52,8 @@
                                 | OPTION_MASK_DIRECT_MOVE              \
                                 | OPTION_MASK_EFFICIENT_UNALIGNED_VSX  \
                                 | OPTION_MASK_QUAD_MEMORY              \
-                                | OPTION_MASK_QUAD_MEMORY_ATOMIC)
+                                | OPTION_MASK_QUAD_MEMORY_ATOMIC       \
+                                | OPTION_MASK_TAR)
 
 /* ISA masks setting fusion options.  */
 #define OTHER_FUSION_MASKS     (OPTION_MASK_P8_FUSION                  \
@@ -159,6 +160,7 @@
                                 | OPTION_MASK_RECIP_PRECISION          \
                                 | OPTION_MASK_SOFT_FLOAT               \
                                 | OPTION_MASK_STRICT_ALIGN_OPTIONAL    \
+                                | OPTION_MASK_TAR                      \
                                 | OPTION_MASK_VSX)
 
 #endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 2921e72aea8..1aac21c4243 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -1224,8 +1224,8 @@ char rs6000_reg_names[][8] =
      "lr", "ctr", "ca", "ap",
   /* cr0..cr7 */
       "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
-  /* vrsave vscr sfp */
-      "vrsave", "vscr", "sfp",
+  /* vrsave vscr sfp, tar */
+      "vrsave", "vscr", "sfp", "tar",
 };
 
 #ifdef TARGET_REGNAMES
@@ -1250,8 +1250,8 @@ static const char alt_reg_names[][8] =
     "lr",  "ctr",   "ca",   "ap",
   /* cr0..cr7 */
   "%cr0",  "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7",
-  /* vrsave vscr sfp */
-  "vrsave", "vscr", "sfp",
+  /* vrsave vscr sfp, tar */
+  "vrsave", "vscr", "sfp", "tar"
 };
 #endif
 
@@ -2304,6 +2304,7 @@ rs6000_debug_reg_global (void)
                          "vs");
   rs6000_debug_reg_print (LR_REGNO, LR_REGNO, "lr");
   rs6000_debug_reg_print (CTR_REGNO, CTR_REGNO, "ctr");
+  rs6000_debug_reg_print (TAR_REGNO, CTR_REGNO, "tar");
   rs6000_debug_reg_print (CR0_REGNO, CR7_REGNO, "cr");
   rs6000_debug_reg_print (CA_REGNO, CA_REGNO, "ca");
   rs6000_debug_reg_print (VRSAVE_REGNO, VRSAVE_REGNO, "vrsave");
@@ -2320,6 +2321,7 @@ rs6000_debug_reg_global (void)
           "wa reg_class = %s\n"
           "we reg_class = %s\n"
           "wr reg_class = %s\n"
+          "wt reg_class = %s\n"
           "wx reg_class = %s\n"
           "wA reg_class = %s\n"
           "\n",
@@ -2328,6 +2330,7 @@ rs6000_debug_reg_global (void)
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wa]],
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_we]],
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]],
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]],
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]],
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wA]]);
 
@@ -2778,6 +2781,7 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
 
   rs6000_regno_regclass[LR_REGNO] = LINK_REGS;
   rs6000_regno_regclass[CTR_REGNO] = CTR_REGS;
+  rs6000_regno_regclass[TAR_REGNO] = LINK_OR_CTR_REGS;
   rs6000_regno_regclass[CA_REGNO] = NO_REGS;
   rs6000_regno_regclass[VRSAVE_REGNO] = VRSAVE_REGS;
   rs6000_regno_regclass[VSCR_REGNO] = VRSAVE_REGS;
@@ -2986,6 +2990,10 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
   if (TARGET_DIRECT_MOVE_128)
     rs6000_constraints[RS6000_CONSTRAINT_we] = VSX_REGS;
 
+  /* Power9 adds a TAR register that can hold the target of a jump.  */
+  if (TARGET_TAR)
+    rs6000_constraints[RS6000_CONSTRAINT_wt] = TAR_REGS;
+
   /* Set up the reload helper and direct move functions.  */
   if (TARGET_VSX || TARGET_ALTIVEC)
     {
@@ -4345,6 +4353,15 @@ rs6000_option_override_internal (bool global_init_p)
   SUB3TARGET_OVERRIDE_OPTIONS;
 #endif
 
+  /* TAR register was introduced in power9.  */
+  if (TARGET_TAR && !TARGET_P9_MISC)
+    {
+      if ((rs6000_isa_flags_explicit & OPTION_MASK_TAR) != 0)
+       error ("%qs requires at least %qs", "-mtar", "-mcpu=power9");
+
+      rs6000_isa_flags &= ~OPTION_MASK_TAR;
+    }
+
   /* If the ABI has support for PC-relative relocations, enable it by default.
      This test depends on the sub-target tests above setting the code model to
      medium for ELF v2 systems.  */
@@ -10216,6 +10233,9 @@ rs6000_conditional_register_usage (void)
        for (i = FIRST_ALTIVEC_REGNO + 20; i < FIRST_ALTIVEC_REGNO + 32; ++i)
          fixed_regs[i] = call_used_regs[i] = 1;
     }
+
+  if (TARGET_TAR)
+    fixed_regs[TAR_REGNO] = 0;
 }
 
 
@@ -14364,10 +14384,13 @@ print_operand (FILE *file, rtx x, int code)
       if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_PLTSEQ)
        x = XVECEXP (x, 0, 0);
       if (!REG_P (x) || (REGNO (x) != LR_REGNO
-                        && REGNO (x) != CTR_REGNO))
+                        && REGNO (x) != CTR_REGNO
+                        && REGNO (x) != TAR_REGNO))
        output_operand_lossage ("invalid %%T value");
       else if (REGNO (x) == LR_REGNO)
        fputs ("lr", file);
+      else if (REGNO (x) == TAR_REGNO)
+       fputs ("tar", file);
       else
        fputs ("ctr", file);
       return;
@@ -24193,6 +24216,8 @@ rs6000_debugger_regno (unsigned int regno, unsigned int 
format)
        return 108;
       if (regno == CTR_REGNO)
        return 109;
+      if (regno == TAR_REGNO)
+       return 112;
       if (regno == CA_REGNO)
        return 101;  /* XER */
       /* Special handling for CR for .debug_frame: rs6000_emit_prologue has
@@ -24495,6 +24520,7 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
   { "recip-precision",         OPTION_MASK_RECIP_PRECISION,    false, true  },
   { "save-toc-indirect",       OPTION_MASK_SAVE_TOC_INDIRECT,  false, true  },
   { "string",                  0,                              false, true  },
+  { "tar",                     OPTION_MASK_TAR,                false, true  },
   { "update",                  OPTION_MASK_NO_UPDATE,          true , true  },
   { "vsx",                     OPTION_MASK_VSX,                false, true  },
 #ifdef OPTION_MASK_64BIT
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 79ce1a8cbf1..0730869903f 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -786,7 +786,7 @@ enum data_align { align_abi, align_opt, align_both };
    Another pseudo (not included in DWARF_FRAME_REGISTERS) is soft frame
    pointer, which is eventually eliminated in favor of SP or FP.  */
 
-#define FIRST_PSEUDO_REGISTER 111
+#define FIRST_PSEUDO_REGISTER 112
 
 /* Use standard DWARF numbering for DWARF debugging information.  */
 #define DEBUGGER_REGNO(REGNO) rs6000_debugger_regno ((REGNO), 0)
@@ -822,8 +822,8 @@ enum data_align { align_abi, align_opt, align_both };
    0, 0, 1, 1,                                    \
    /* cr0..cr7 */                                 \
    0, 0, 0, 0, 0, 0, 0, 0,                        \
-   /* vrsave vscr sfp */                          \
-   1, 1, 1                                        \
+   /* vrsave vscr sfp, tar */                     \
+   1, 1, 1, 1                                     \
 }
 
 /* Like `CALL_USED_REGISTERS' except this macro doesn't require that
@@ -846,8 +846,8 @@ enum data_align { align_abi, align_opt, align_both };
    1, 1, 1, 1,                                    \
    /* cr0..cr7 */                                 \
    1, 1, 0, 0, 0, 1, 1, 1,                        \
-   /* vrsave vscr sfp */                          \
-   0, 0, 0                                        \
+   /* vrsave vscr sfp, tar */                     \
+   0, 0, 0, 1                                     \
 }
 
 #define TOTAL_ALTIVEC_REGS     (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1)
@@ -876,6 +876,7 @@ enum data_align { align_abi, align_opt, align_both };
        r0              (not saved; cannot be base reg)
        r31 - r13       (saved; order given to save least number)
        r12             (not saved; if used for DImode or DFmode would use r13)
+       tar             (not saved; tar is preferred over ctr or lr)
        ctr             (not saved; when we have the choice ctr is better)
        lr              (saved)
        r1, r2, ap, ca  (fixed)
@@ -918,7 +919,7 @@ enum data_align { align_abi, align_opt, align_both };
    3, EARLY_R12 11, 0,                                         \
    31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19,         \
    18, 17, 16, 15, 14, 13, LATE_R12                            \
-   97, 96,                                                     \
+   111, 97, 96,                                                        \
    1, MAYBE_R2_FIXED 99, 98,                                   \
    /* AltiVec registers.  */                                   \
    64, 65,                                                     \
@@ -1093,6 +1094,7 @@ enum reg_class
   GEN_OR_VSX_REGS,
   LINK_REGS,
   CTR_REGS,
+  TAR_REGS,
   LINK_OR_CTR_REGS,
   SPECIAL_REGS,
   SPEC_OR_GEN_REGS,
@@ -1122,6 +1124,7 @@ enum reg_class
   "GEN_OR_VSX_REGS",                                                   \
   "LINK_REGS",                                                         \
   "CTR_REGS",                                                          \
+  "TAR_REGS",                                                          \
   "LINK_OR_CTR_REGS",                                                  \
   "SPECIAL_REGS",                                                      \
   "SPEC_OR_GEN_REGS",                                                  \
@@ -1162,22 +1165,24 @@ enum reg_class
   { 0x00000000, 0x00000000, 0x00000000, 0x00000001 },                  \
   /* CTR_REGS.  */                                                     \
   { 0x00000000, 0x00000000, 0x00000000, 0x00000002 },                  \
+  /* TAR_REGS.  */                                                     \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00008000 },                  \
   /* LINK_OR_CTR_REGS.  */                                             \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00000003 },                  \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00008003 },                  \
   /* SPECIAL_REGS.  */                                                 \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00001003 },                  \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00009003 },                  \
   /* SPEC_OR_GEN_REGS.  */                                             \
-  { 0xffffffff, 0x00000000, 0x00000000, 0x0000500b },                  \
+  { 0xffffffff, 0x00000000, 0x00000000, 0x0000d00b },                  \
   /* CR0_REGS.  */                                                     \
   { 0x00000000, 0x00000000, 0x00000000, 0x00000010 },                  \
   /* CR_REGS.  */                                                      \
   { 0x00000000, 0x00000000, 0x00000000, 0x00000ff0 },                  \
   /* NON_FLOAT_REGS.  */                                               \
-  { 0xffffffff, 0x00000000, 0x00000000, 0x00004ffb },                  \
+  { 0xffffffff, 0x00000000, 0x00000000, 0x0000cffb },                  \
   /* CA_REGS.  */                                                      \
   { 0x00000000, 0x00000000, 0x00000000, 0x00000004 },                  \
   /* ALL_REGS.  */                                                     \
-  { 0xffffffff, 0xffffffff, 0xffffffff, 0x00007fff }                   \
+  { 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff }                   \
 }
 
 /* The same information, inverted:
@@ -1199,6 +1204,7 @@ enum r6000_reg_class_enum {
   RS6000_CONSTRAINT_wa,                /* Any VSX register */
   RS6000_CONSTRAINT_we,                /* VSX register if ISA 3.0 vector. */
   RS6000_CONSTRAINT_wr,                /* GPR register if 64-bit  */
+  RS6000_CONSTRAINT_wt,                /* TAR register.  */
   RS6000_CONSTRAINT_wx,                /* FPR register for STFIWX */
   RS6000_CONSTRAINT_wA,                /* BASE_REGS if 64-bit.  */
   RS6000_CONSTRAINT_MAX
@@ -2077,7 +2083,8 @@ extern char rs6000_reg_names[][8];        /* register 
names (0 vs. %r0).  */
   &rs6000_reg_names[108][0],   /* vrsave  */                           \
   &rs6000_reg_names[109][0],   /* vscr  */                             \
                                                                        \
-  &rs6000_reg_names[110][0]    /* sfp  */                              \
+  &rs6000_reg_names[110][0],   /* sfp  */                              \
+  &rs6000_reg_names[111][0]    /* tar  */                              \
 }
 
 /* Table of additional register names to use in user input.  */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index abc809448ad..404ff3d9cb2 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -51,6 +51,7 @@
    (VRSAVE_REGNO               108)
    (VSCR_REGNO                 109)
    (FRAME_POINTER_REGNUM       110)
+   (TAR_REGNO                  111)
   ])
 
 ;;
@@ -8119,9 +8120,9 @@
 
 (define_insn "*movcc_<mode>"
   [(set (match_operand:CC_any 0 "nonimmediate_operand"
-                               "=y,x,?y,y,r,r,r,r, r,*c*l,r,m")
+                               "=y,x,?y,y,r,r,r,r, r,*wt*c*l,r,m")
        (match_operand:CC_any 1 "general_operand"
-                               " y,r, r,O,x,y,r,I,*h,   r,m,r"))]
+                               " y,r, r,O,x,y,r,I,*h,      r,m,r"))]
   "register_operand (operands[0], <MODE>mode)
    || register_operand (operands[1], <MODE>mode)"
   "@
@@ -8209,7 +8210,7 @@
   [(set (match_operand:SF 0 "nonimmediate_operand"
         "=!r,       f,         v,          wa,        m,         wY,
          Z,         m,         wa,         !r,        f,         wa,
-         !r,        *c*l,      !r,         *h,        wa")
+         !r,        *wt*c*l,  !r,         *h,        wa")
        (match_operand:SF 1 "input_operand"
         "m,         m,         wY,         Z,         f,         v,
          wa,        r,         j,          j,         f,         wa,
@@ -8255,7 +8256,7 @@
 (define_insn "movsd_hardfloat"
   [(set (match_operand:SD 0 "nonimmediate_operand"
         "=!r,       d,         m,         ?Z,        ?d,        ?r,
-         f,         !r,        *c*l,      !r,        *h")
+         f,         !r,        *wt*c*l,   !r,        *h")
        (match_operand:SD 1 "input_operand"
         "m,         ?Z,        r,         wx,        r,         d,
          f,         r,         r,         *h,        0"))]
@@ -8285,7 +8286,7 @@
 ;;     LIS          G-const.   F/n-const  NOP
 (define_insn "*mov<mode>_softfloat"
   [(set (match_operand:FMOVE32 0 "nonimmediate_operand"
-       "=r,         *c*l,      r,         r,         m,         r,
+       "=r,         *wt*c*l,   r,         r,         m,         r,
           r,         r,         r,         *h")
 
        (match_operand:FMOVE32 1 "input_operand"
@@ -8599,7 +8600,7 @@
   [(set (match_operand:FMOVE64 0 "nonimmediate_operand"
            "=m,           d,          d,          <f64_p9>,   wY,
              <f64_av>,    Z,          <f64_vsx>,  <f64_vsx>,  !r,
-             YZ,          r,          !r,         *c*l,       !r,
+             YZ,          r,          !r,         *wt*c*l*wt, !r,
             *h,           r,          <f64_dm>,   wa")
        (match_operand:FMOVE64 1 "input_operand"
             "d,           m,          d,          wY,         <f64_p9>,
@@ -8651,7 +8652,7 @@
 
 (define_insn "*mov<mode>_softfloat64"
   [(set (match_operand:FMOVE64 0 "nonimmediate_operand"
-           "=Y,       r,      r,      *c*l,   r,      r,
+           "=Y,       r,      r,      *wt*c*l, r,      r,
              r,       r,      *h")
 
        (match_operand:FMOVE64 1 "input_operand"
@@ -13500,14 +13501,14 @@
 
 (define_insn "*indirect_jump<mode>"
   [(set (pc)
-       (match_operand:P 0 "register_operand" "c,*l"))]
+       (match_operand:P 0 "register_operand" "wt,c,*l"))]
   "rs6000_speculate_indirect_jumps"
   "b%T0"
   [(set_attr "type" "jmpreg")])
 
 (define_insn "@indirect_jump<mode>_nospec"
-  [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))
-   (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))]
+  [(set (pc) (match_operand:P 0 "register_operand" "wt,c,*l"))
+   (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y,y"))]
   "!rs6000_speculate_indirect_jumps"
   "crset %E1\;beq%T0- %1\;b $"
   [(set_attr "type" "jmpreg")
@@ -13613,7 +13614,7 @@
 
 (define_insn "@tablejump<mode>_insn_normal"
   [(set (pc)
-       (match_operand:P 0 "register_operand" "c,*l"))
+       (match_operand:P 0 "register_operand" "wt,c,*l"))
    (use (label_ref (match_operand 1)))]
   "rs6000_speculate_indirect_jumps"
   "b%T0"
@@ -13621,9 +13622,9 @@
 
 (define_insn "@tablejump<mode>_insn_nospec"
   [(set (pc)
-       (match_operand:P 0 "register_operand" "c,*l"))
+       (match_operand:P 0 "register_operand" "wt,c,*l"))
    (use (label_ref (match_operand 1)))
-   (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))]
+   (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y,y"))]
   "!rs6000_speculate_indirect_jumps"
   "crset %E2\;beq%T0- %2\;b $"
   [(set_attr "type" "jmpreg")
@@ -13697,7 +13698,7 @@
                          (const_int 1))
                      (label_ref (match_operand 0))
                      (pc)))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wa*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wa*wt*c*l")
        (plus:P (match_dup 1)
                (const_int -1)))
    (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
@@ -13773,7 +13774,7 @@
                       (const_int 0)]))
          (label_ref (match_operand 0))
          (pc)))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wa*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wa*wt*c*l")
        (plus:P (match_dup 1)
                (const_int -1)))
    (clobber (match_scratch:P 5 "=X,X,&r,r"))
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 621ebd65a88..8e9215a32c2 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -603,6 +603,10 @@ mmma
 Target Mask(MMA) Var(rs6000_isa_flags)
 Generate (do not generate) MMA instructions.
 
+mtar
+Target Mask(TAR) Var(rs6000_isa_flags)
+Generate (do not generate) code using the TAR register.
+
 mrelative-jumptables
 Target Undocumented Var(rs6000_relative_jumptables) Init(1) Save
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 36d6e18dabb..05806c2c769 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1332,7 +1332,7 @@ See RS/6000 and PowerPC Options.
 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
--mprivileged -mno-privileged}
+-mprivileged -mno-privileged -mtar -mno-tar}
 
 @emph{RX Options}
 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
@@ -31307,7 +31307,7 @@ following options:
 -mcrypto  -mhtm  -mpower8-fusion
 -mquad-memory  -mquad-memory-atomic  -mfloat128
 -mfloat128-hardware -mprefixed -mpcrel -mmma
--mrop-protect}
+-mrop-protect -mtar}
 
 The particular options set for any particular CPU varies between
 compiler versions, depending on what setting seems to produce optimal
@@ -32310,6 +32310,14 @@ Generate (do not generate) ROP protection instructions 
when the target
 processor supports them.  Currently this option disables the shrink-wrap
 optimization (@option{-fshrink-wrap}).
 
+@opindex mtar
+@opindex mno-tar
+@item -mtar
+@itemx -mno-tar
+Generate (do not generate) code that uses the @code{TAR} register.
+The @option{-mtar} option requires that the option
+@option{-mcpu=power9} (or later) is enabled.
+
 @opindex mprivileged
 @opindex mno-privileged
 @item -mprivileged

Reply via email to