https://gcc.gnu.org/g:08dd6bc886f7d7a42332d19c66f47c735676dc11

commit 08dd6bc886f7d7a42332d19c66f47c735676dc11
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Mon Apr 8 23:40:42 2024 -0400

    Add -mcpu=future2
    
    2024-04-08  Michael Meissner  <meiss...@linux.ibm.com>
    
    gcc/
    
            * config/rs6000/aix71.h (ASM_CPU_SPEC): Add support for 
-mcpu=future2.
            * config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise.
            * config/rs6000/aix73.h (ASM_CPU_SPEC): Likewise.
            * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define
            _ARCH_PWR_FUTURE2 if -mcpu=future.
            * config/rs6000/rs6000-cpus.def (ISA_FUTURE2_MASKS_SERVER): New 
macro.
            (POWERPC_MASKS): Add support for -mcpu=future2.
            (future2 processor): Likewise.
            * config/rs6000/rs6000-tables.opt: Regenerate
            * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for 
-mcpu=future2.
            * config/rs6000/rs6000.opt (-mfuture2): New internal option.
    
    gcc/testsuite/
    
            * lib/target-supports.exp 
(check_effective_target_powerpc_future2_ok):
            New effective target test.

Diff:
---
 gcc/config/rs6000/aix71.h             |  1 +
 gcc/config/rs6000/aix72.h             |  1 +
 gcc/config/rs6000/aix73.h             |  1 +
 gcc/config/rs6000/rs6000-c.cc         |  2 ++
 gcc/config/rs6000/rs6000-cpus.def     |  5 +++++
 gcc/config/rs6000/rs6000-tables.opt   |  3 +++
 gcc/config/rs6000/rs6000.cc           |  1 +
 gcc/config/rs6000/rs6000.h            |  1 +
 gcc/config/rs6000/rs6000.opt          |  4 ++++
 gcc/testsuite/lib/target-supports.exp | 13 +++++++++++++
 10 files changed, 32 insertions(+)

diff --git a/gcc/config/rs6000/aix71.h b/gcc/config/rs6000/aix71.h
index 570ddcc451d..34bbad65dbe 100644
--- a/gcc/config/rs6000/aix71.h
+++ b/gcc/config/rs6000/aix71.h
@@ -79,6 +79,7 @@ do {                                                          
        \
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=future2: -mfuture; \
   mcpu=future: -mfuture; \
   mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
diff --git a/gcc/config/rs6000/aix72.h b/gcc/config/rs6000/aix72.h
index 242ca94bd06..f5e66084553 100644
--- a/gcc/config/rs6000/aix72.h
+++ b/gcc/config/rs6000/aix72.h
@@ -79,6 +79,7 @@ do {                                                          
        \
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=future2: -mfuture; \
   mcpu=future: -mfuture; \
   mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
diff --git a/gcc/config/rs6000/aix73.h b/gcc/config/rs6000/aix73.h
index 2bd6b4bb3c4..1140f0f6098 100644
--- a/gcc/config/rs6000/aix73.h
+++ b/gcc/config/rs6000/aix73.h
@@ -79,6 +79,7 @@ do {                                                          
        \
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=future2: -mfuture; \
   mcpu=future: -mfuture; \
   mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index acd44058876..f0461e5817a 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -451,6 +451,8 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT 
flags)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR11");
   if ((flags & OPTION_MASK_FUTURE) != 0)
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR_FUTURE");
+  if ((flags & OPTION_MASK_FUTURE2) != 0)
+    rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR_FUTURE2");
   if ((flags & OPTION_MASK_SOFT_FLOAT) != 0)
     rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT");
   if ((flags & OPTION_MASK_RECIP_PRECISION) != 0)
diff --git a/gcc/config/rs6000/rs6000-cpus.def 
b/gcc/config/rs6000/rs6000-cpus.def
index 4ddba142e44..fee97c96197 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -93,6 +93,9 @@
                                 | OPTION_MASK_BLOCK_OPS_VECTOR_PAIR    \
                                 | OPTION_MASK_FUTURE)
 
+#define ISA_FUTURE2_MASKS_SERVER (ISA_FUTURE_MASKS_SERVER              \
+                                 | OPTION_MASK_FUTURE2)
+
 /* Flags that need to be turned off if -mno-vsx.  */
 #define OTHER_VSX_VECTOR_MASKS (OPTION_MASK_EFFICIENT_UNALIGNED_VSX    \
                                 | OPTION_MASK_FLOAT128_KEYWORD         \
@@ -133,6 +136,7 @@
                                 | OPTION_MASK_FLOAT128_KEYWORD         \
                                 | OPTION_MASK_FPRND                    \
                                 | OPTION_MASK_FUTURE                   \
+                                | OPTION_MASK_FUTURE2                  \
                                 | OPTION_MASK_POWER10                  \
                                 | OPTION_MASK_POWER11                  \
                                 | OPTION_MASK_P10_FUSION               \
@@ -269,3 +273,4 @@ RS6000_CPU ("powerpc64le", PROCESSOR_POWER8, MASK_POWERPC64
 RS6000_CPU ("rs64", PROCESSOR_RS64A, OPTION_MASK_PPC_GFXOPT | MASK_POWERPC64)
 RS6000_CPU ("power11", PROCESSOR_POWER11, MASK_POWERPC64 | 
ISA_POWER11_MASKS_SERVER)
 RS6000_CPU ("future", PROCESSOR_FUTURE, MASK_POWERPC64 | 
ISA_FUTURE_MASKS_SERVER)
+RS6000_CPU ("future2", PROCESSOR_FUTURE, MASK_POWERPC64 | 
ISA_FUTURE2_MASKS_SERVER)
diff --git a/gcc/config/rs6000/rs6000-tables.opt 
b/gcc/config/rs6000/rs6000-tables.opt
index f009c4e5718..291e295331e 100644
--- a/gcc/config/rs6000/rs6000-tables.opt
+++ b/gcc/config/rs6000/rs6000-tables.opt
@@ -203,3 +203,6 @@ Enum(rs6000_cpu_opt_value) String(power11) Value(57)
 EnumValue
 Enum(rs6000_cpu_opt_value) String(future) Value(58)
 
+EnumValue
+Enum(rs6000_cpu_opt_value) String(future2) Value(59)
+
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 573602d0c11..42e9fa1dc56 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -24643,6 +24643,7 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
   { "float128-hardware",       OPTION_MASK_FLOAT128_HW,        false, true  },
   { "fprnd",                   OPTION_MASK_FPRND,              false, true  },
   { "future",                  OPTION_MASK_FUTURE,             false, false },
+  { "future2",                 OPTION_MASK_FUTURE2,            false, false },
   { "power10",                 OPTION_MASK_POWER10,            false, true  },
   { "power11",                 OPTION_MASK_POWER11,            false, false },
   { "hard-dfp",                        OPTION_MASK_DFP,                false, 
true  },
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 67ef3d3a7d0..7936c65d4ab 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -106,6 +106,7 @@
    you make changes here, make them also there.  */
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=future2: -mfuture; \
   mcpu=future: -mfuture; \
   mcpu=power11: -mpower11; \
   mcpu=power10: -mpower10; \
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 621ebd65a88..97120a0b64b 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -587,6 +587,10 @@ Target Undocumented Mask(POWER11) Var(rs6000_isa_flags) 
Warn(Do not use %<-mpowe
 mfuture
 Target Undocumented Mask(FUTURE) Var(rs6000_isa_flags) Warn(Do not use 
%<-mfuture>)
 
+;; Possible future bits beyound -mcpu=future
+mfuture2
+Target Undocumented Mask(FUTURE2) Var(rs6000_isa_flags) Warn(Do not use 
%<-mfuture2>)
+
 mprefixed
 Target Mask(PREFIXED) Var(rs6000_isa_flags)
 Generate (do not generate) prefixed memory instructions.
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 333cf788b96..15436910018 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7138,6 +7138,19 @@ proc check_effective_target_powerpc_future_ok { } {
        } "-mcpu=future"]
 }
 
+# Return 1 if this is a PowerPC target supporting -mcpu=future2 which enables
+# potential instructins beyond -mcpu=future.  Note, the assembler may not
+# have support for these instructions.
+proc check_effective_target_powerpc_future2_ok { } {
+       return [check_no_compiler_messages powerpc_future2_ok assembly {
+           #ifndef _ARCH_PWR_FUTURE2
+           #error "-mcpu=future2 is not supported"
+           #else
+           int dummy;
+           #endif
+       } "-mcpu=future2"]
+}
+
 # Return 1 if this is a PowerPC target supporting -mcpu=future which enables
 # the dense math operations.
 proc check_effective_target_powerpc_dense_math_ok { } {

Reply via email to