https://gcc.gnu.org/g:d68704997f2e73fcecf75d74fc1559b7fe055463

commit d68704997f2e73fcecf75d74fc1559b7fe055463
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Thu Nov 14 14:47:53 2024 -0500

    Change TARGET_MODULO to TARGET_POWER9.
    
    This patch changes TARGET_MODULO to TARGET_POWER9 and OPTION_MASK_MODULO to
    OPTION_MASK_POWER9.  The -mmodulo switch is not being changed, just the 
name of
    the macros used to determine if the PowerPC processor supports ISA 3.0 
(Power9).
    
    2024-11-14  Michael Meissner  <meiss...@linux.ibm.com>
    
    gcc/
    
            * gcc/config/rs6000/rs6000-builtin.cc (rs6000_builtin_is_supported):
            Change TARGET_MODULO to TARGET_POWER9.  Change OPTION_MASK_MODULO to
            OPTION_MASK_POWER9.
            * gcc/config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): 
Likewise.
            * gcc/config/rs6000/rs6000-cpus.def (ISA_3_0_MASKS_SERVER): 
Likewise.
            (POWERPC_MASKS): Likewise.
            * gcc/config/rs6000/rs6000.cc (rs6000_option_override_internal):
            Likewise.
            (rs6000_opt_masks): Likewise.
            * gcc/config/rs6000/rs6000.h (TARGET_CTZ): Likewise.
            (TARGET_EXTSWSLI): Likewise.
            (TARGET_MADDLD): Likewise.
            * gcc/config/rs6000/rs6000.md (enabled attribute): Likewise.
            (mod<mode>3): Likewise.
            (umod<mode>3): Likewise.
            (divide/modulo peephole2): Likewise.
            * gcc/config/rs6000/rs6000.opt (-mmodulo): Likewise.

Diff:
---
 gcc/config/rs6000/rs6000-builtin.cc |  4 ++--
 gcc/config/rs6000/rs6000-c.cc       |  2 +-
 gcc/config/rs6000/rs6000-cpus.def   |  4 ++--
 gcc/config/rs6000/rs6000.cc         |  6 +++---
 gcc/config/rs6000/rs6000.h          |  6 +++---
 gcc/config/rs6000/rs6000.md         | 14 +++++++-------
 gcc/config/rs6000/rs6000.opt        |  6 ++++--
 7 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-builtin.cc 
b/gcc/config/rs6000/rs6000-builtin.cc
index dae43b672ea7..b6093b3cb64c 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -169,9 +169,9 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins 
fncode)
     case ENB_P8V:
       return TARGET_P8_VECTOR;
     case ENB_P9:
-      return TARGET_MODULO;
+      return TARGET_POWER9;
     case ENB_P9_64:
-      return TARGET_MODULO && TARGET_POWERPC64;
+      return TARGET_POWER9 && TARGET_POWERPC64;
     case ENB_P9V:
       return TARGET_P9_VECTOR;
     case ENB_P10:
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 5bdd6a45db6a..25c662a9ca86 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -432,7 +432,7 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT 
flags)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
   if ((flags & OPTION_MASK_POWER8) != 0)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8");
-  if ((flags & OPTION_MASK_MODULO) != 0)
+  if ((flags & OPTION_MASK_POWER9) != 0)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR9");
   if ((flags & OPTION_MASK_POWER10) != 0)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR10");
diff --git a/gcc/config/rs6000/rs6000-cpus.def 
b/gcc/config/rs6000/rs6000-cpus.def
index 01ab0c0d6b7c..c84af0c54cae 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -62,7 +62,7 @@
    FLOAT128_HW here until we are ready to make -mfloat128 on by default.  */
 #define ISA_3_0_MASKS_SERVER   ((ISA_2_7_MASKS_SERVER                  \
                                  | OPTION_MASK_ISEL                    \
-                                 | OPTION_MASK_MODULO                  \
+                                 | OPTION_MASK_POWER9                  \
                                  | OPTION_MASK_P9_MINMAX               \
                                  | OPTION_MASK_P9_MISC                 \
                                  | OPTION_MASK_P9_VECTOR)              \
@@ -132,7 +132,7 @@
                                 | OPTION_MASK_ISEL                     \
                                 | OPTION_MASK_MFCRF                    \
                                 | OPTION_MASK_MMA                      \
-                                | OPTION_MASK_MODULO                   \
+                                | OPTION_MASK_POWER9                   \
                                 | OPTION_MASK_MULHW                    \
                                 | OPTION_MASK_NO_UPDATE                \
                                 | OPTION_MASK_POWER8                   \
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index eae5937972ed..2c101b589d9a 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -3886,7 +3886,7 @@ rs6000_option_override_internal (bool global_init_p)
 
   /* For the newer switches (vsx, dfp, etc.) set some of the older options,
      unless the user explicitly used the -mno-<option> to disable the code.  */
-  if (TARGET_P9_VECTOR || TARGET_MODULO || TARGET_P9_MISC)
+  if (TARGET_P9_VECTOR || TARGET_POWER9 || TARGET_P9_MISC)
     rs6000_isa_flags |= (ISA_3_0_MASKS_SERVER & ~ignore_masks);
   else if (TARGET_P9_MINMAX)
     {
@@ -22416,7 +22416,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int 
outer_code,
            *total = rs6000_cost->divsi;
        }
       /* Add in shift and subtract for MOD unless we have a mod instruction. */
-      if ((!TARGET_MODULO
+      if ((!TARGET_POWER9
           || (RS6000_DISABLE_SCALAR_MODULO && SCALAR_INT_MODE_P (mode)))
         && (code == MOD || code == UMOD))
        *total += COSTS_N_INSNS (2);
@@ -24499,7 +24499,7 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
   { "mfcrf",                   OPTION_MASK_MFCRF,              false, true  },
   { "mfpgpr",                  0,                              false, true  },
   { "mma",                     OPTION_MASK_MMA,                false, true  },
-  { "modulo",                  OPTION_MASK_MODULO,             false, true  },
+  { "modulo",                  OPTION_MASK_POWER9,             false, true  },
   { "mulhw",                   OPTION_MASK_MULHW,              false, true  },
   { "multiple",                        OPTION_MASK_MULTIPLE,           false, 
true  },
   { "pcrel",                   OPTION_MASK_PCREL,              false, true  },
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 97f5d6bb8d9b..9afb02195e0e 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -463,9 +463,9 @@ extern int rs6000_vector_align[];
 #define TARGET_FCTIWUZ TARGET_POWER7
 /* Only powerpc64 and powerpc476 support fctid.  */
 #define TARGET_FCTID   (TARGET_POWERPC64 || rs6000_cpu == PROCESSOR_PPC476)
-#define TARGET_CTZ     TARGET_MODULO
-#define TARGET_EXTSWSLI        (TARGET_MODULO && TARGET_POWERPC64)
-#define TARGET_MADDLD  TARGET_MODULO
+#define TARGET_CTZ     TARGET_POWER9
+#define TARGET_EXTSWSLI        (TARGET_POWER9 && TARGET_POWERPC64)
+#define TARGET_MADDLD  TARGET_POWER9
 
 /* TARGET_DIRECT_MOVE is redundant to TARGET_P8_VECTOR, so alias it to that.  
*/
 #define TARGET_DIRECT_MOVE     TARGET_P8_VECTOR
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index fd2d4d3b7127..9643763fb2af 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -403,7 +403,7 @@
      (const_int 1)
 
      (and (eq_attr "isa" "p9")
-         (match_test "TARGET_MODULO"))
+         (match_test "TARGET_POWER9"))
      (const_int 1)
 
      (and (eq_attr "isa" "p9v")
@@ -3457,7 +3457,7 @@
       || INTVAL (operands[2]) <= 0
       || (i = exact_log2 (INTVAL (operands[2]))) < 0)
     {
-      if (!TARGET_MODULO)
+      if (!TARGET_POWER9)
        FAIL;
 
       operands[2] = force_reg (<MODE>mode, operands[2]);
@@ -3491,7 +3491,7 @@
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=&r,r")
         (mod:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
                 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
-  "TARGET_MODULO && !RS6000_DISABLE_SCALAR_MODULO"
+  "TARGET_POWER9 && !RS6000_DISABLE_SCALAR_MODULO"
   "mods<wd> %0,%1,%2"
   [(set_attr "type" "div")
    (set_attr "size" "<bits>")])
@@ -3502,7 +3502,7 @@
   [(set (match_operand:GPR 0 "gpc_reg_operand")
        (umod:GPR (match_operand:GPR 1 "gpc_reg_operand")
                  (match_operand:GPR 2 "gpc_reg_operand")))]
-  "TARGET_MODULO"
+  "TARGET_POWER9"
 {
   if (RS6000_DISABLE_SCALAR_MODULO)
     {
@@ -3520,7 +3520,7 @@
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=&r,r")
         (umod:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r")
                  (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
-  "TARGET_MODULO && !RS6000_DISABLE_SCALAR_MODULO"
+  "TARGET_POWER9 && !RS6000_DISABLE_SCALAR_MODULO"
   "modu<wd> %0,%1,%2"
   [(set_attr "type" "div")
    (set_attr "size" "<bits>")])
@@ -3536,7 +3536,7 @@
    (set (match_operand:GPR 3 "gpc_reg_operand")
        (mod:GPR (match_dup 1)
                 (match_dup 2)))]
-  "TARGET_MODULO
+  "TARGET_POWER9
    && ! reg_mentioned_p (operands[0], operands[1])
    && ! reg_mentioned_p (operands[0], operands[2])
    && ! reg_mentioned_p (operands[3], operands[1])
@@ -3558,7 +3558,7 @@
    (set (match_operand:GPR 3 "gpc_reg_operand")
        (umod:GPR (match_dup 1)
                  (match_dup 2)))]
-  "TARGET_MODULO
+  "TARGET_POWER9
    && ! reg_mentioned_p (operands[0], operands[1])
    && ! reg_mentioned_p (operands[0], operands[2])
    && ! reg_mentioned_p (operands[3], operands[1])
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index b82dac0237c0..1a34cdac1158 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -541,9 +541,11 @@ mpower9-minmax
 Target Undocumented Mask(P9_MINMAX) Var(rs6000_isa_flags)
 Use the new min/max instructions defined in ISA 3.0.
 
+;; Originally, we used -mmodulo to indicate ISA 3.0.  Keep the switch name,
+;; but change the target macro.
 mmodulo
-Target Undocumented Mask(MODULO) Var(rs6000_isa_flags)
-Generate the integer modulo instructions.
+Target Undocumented Mask(POWER9) Var(rs6000_isa_flags)
+Use ISA 3.0 (Power9) instructions.
 
 mfloat128
 Target Mask(FLOAT128_KEYWORD) Var(rs6000_isa_flags)

Reply via email to