https://gcc.gnu.org/g:2bb709c1264ac4c65e43616a5f58ed4eca2d3280

commit 2bb709c1264ac4c65e43616a5f58ed4eca2d3280
Author: Michael Meissner <[email protected]>
Date:   Thu Jun 25 02:46:26 2026 -0400

    Add support for dense math registers.
    
    This is part four of the dense math register patches for the PowerPC.
    This is the 7th version of the dense math patches.
    
    Version 6 of the dense math register patches were posted on April 21st,
    2026.
    
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713352.html
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713353.html
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713354.html
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713355.html
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713356.html
     * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713357.html
    
    This patch needs the -mcpu=future patch posted on April 8th, 2026:
    
      * https://gcc.gnu.org/pipermail/gcc-patches/2026-April/712532.html
    
    This patch (#4) combines version 6 patch #3 (which adds the basic dense math
    register support) and the parts of patch #4 (switch mmf.md to use the new wD
    constraint, use accumulator_operand, and add dense math zero/move support) 
that
    weren't previously added in version 7 patch #1.  Here are the changes from
    version 6 of the patches:
    
            dense_math_operand                      to dmf_register_operand
            FIRST_DM_REGNO                          to FIRST_DMF_REGNO
            LAST_DM_REGNO                           to LAST_DMF_REGNO
            UNITS_PER_DM_WORD                       to UNITS_PER_DMF_WORD
            DM_REGNO_P                              to DMF_REGNO_P
            DM_REGS                                 to DMF_REGS
            DM_REG_TYPE                             to DMF_REG_TYPE
            rs6000_dense_math_register_move_cost    to 
rs6000_dmf_register_move_cost
    
    I have built bootstrap little endian compilers on power10 systems, and
    big endian compiler on power9 systems.  There were no regression in the
    tests.  Can I add the patches to the GCC trunk after the -mcpu=future
    patch is applied and GCC 17 has opened up?
    
    2026-06-25   Michael Meissner  <[email protected]>
    
    gcc/
    
            * config/rs6000/mma.md (movoo): Allow -mdense-math -mno-mma.
            (movxo): Convert to being a define_expand that can handle both the
            original MMA support without dense math registers, and adding dense 
math
            support.  Allow -mdense-math -mno-mma.
            (movxo_nodm): Rename original movxo insn, and restrict this insn to 
when
            we do not have dense math registers.
            (movxo_dm): New define_insn_and_split for dense math registers.
            (vsx_assemble_pair): Allow -mdense-math -mno-mma.
            (vsx_disassemble_pair): Likewise.
            (mma_assemble_acc): Likewise.
            (mma_disassemble_acc): Likewise.
            (mma_<acc>): Allow built-ins to be used if -mdense-math.
            (mma_xxsetaccz): Convert into a define_expand to handle both 
non-dense
            math and dense math registers.
            (mma_xxsetaccz_nodm): Rename from mma_xxsetaccz and limit code to 
non
            dense math systems.
            (mma_xxsetaccz_dm): New insn for direct math register support.
            * config/rs6000/predicates.md (dmf_register_operand): New predicate.
            (accumulator_operand): Add support for dense math registers.
            * config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_mma_builtin): 
Do
            not issue xxmfacc (deprime) instruction if we have dense math 
registers.
            * config/rs6000/rs6000-cpus.def (FUTURE_MASKS_SERVER): Add 
-mdense-math.
            (POWERPC_MASKS): Likewise.
            * config/rs6000/rs6000.cc (enum rs6000_reg_type): Add dense math
            register support.
            (enum rs6000_reload_reg_typ): Likewise.
            (LAST_RELOAD_REG_CLASS): Likewise.
            (reload_reg_map): Likewise.
            (rs6000_reg_names): Likewise.
            (alt_reg_names): Likewise.
            (rs6000_hard_regno_nregs_internal): Likewise.
            (rs6000_hard_regno_mode_ok_uncached): Likewise.
            (rs6000_debug_reg_global): Likewise.
            (rs6000_setup_reg_addr_masks): Likewise.
            (rs6000_init_hard_regno_mode_ok): Likewise.
            (rs6000_secondary_reload_memory): Likewise.
            (rs6000_secondary_reload_simple_move): Likewise.
            (rs6000_preferred_reload_class): Likewise.
            (rs6000_secondary_reload_class): Likewise.
            (print_operand): Likewise.
            (rs6000_dmf_register_move_cost): New helper function.
            (rs6000_register_move_cost): Add dense math register support.
            (rs6000_memory_move_cost): Likewise.
            (rs6000_compute_pressure_classes): Likewise.
            (rs6000_debugger_regno): Likewise.
            (rs6000_opt_masks): Likewise.
            (rs6000_split_multireg_move): Likewise.
            * config/rs6000/rs6000.h (UNITS_PER_DMF_WORD): New macro.
            (FIRST_PSEUDO_REGISTER): Add dense math register support.
            (FIXED_REGISTERS): Likewise.
            (CALL_REALLY_USED_REGISTERS): Likewise.
            (REG_ALLOC_ORDER): Likewise.
            (DMF_REGNO_P): New macro.
            (enum reg_class): Add dense math register support.
            (REG_CLASS_NAMES): Likewise.
            (REGISTER_NAMES): Likewise.
            (ADDITIONAL_REGISTER_NAMES): Likewise.
            * config/rs6000/rs6000.md (FIRST_DMF_REGNO): New constant.
            (LAST_DMF_REGNO): Likewise.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 07b6c690ad5f..c40fc3a8a255 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -1897,6 +1897,7 @@ rs6000_hard_regno_mode_ok_uncached (int regno, 
machine_mode mode)
                && (regno & 1) == 0);
     }
 
+<<<<<<< HEAD
   if (mode == TDOmode)
     {
       if (!TARGET_DENSE_MATH)
@@ -1913,6 +1914,9 @@ rs6000_hard_regno_mode_ok_uncached (int regno, 
machine_mode mode)
 
   /* No other types other than XOmode or TDOmode can go in dense math
      registers.  */
+=======
+  /* No other types other than XOmode can go in dense math registers.  */
+>>>>>>> d5eee992f97 (Add support for dense math registers.)
   if (DMF_REGNO_P (regno))
     return 0;
 
@@ -2703,7 +2707,11 @@ rs6000_setup_reg_addr_masks (void)
          /* Special case dense math registers.  */
          if (rc == RELOAD_REG_DMR)
            {
+<<<<<<< HEAD
              if (TARGET_DENSE_MATH && (m2 == XOmode || m2 == TDOmode))
+=======
+             if (TARGET_DENSE_MATH && m2 == XOmode)
+>>>>>>> d5eee992f97 (Add support for dense math registers.)
                {
                  addr_mask = RELOAD_REG_VALID;
                  reg_addr[m].addr_mask[rc] = addr_mask;

Reply via email to