Kishan Parmar <[email protected]> issued a patch that made me re-examine the
code I had put out for dense math registers.  This patch fixes the
first of the two problems.

The problem is if -mregnames is used, the wrong name is emitted.  Gcc
emitted %dmr<n>, while the GAS assembler wants %dm<n>.

I originally had modified print_output's %A<n> handling to emit the
%dm<n> register name, but it turns out the assembler doesn't like using
%dm<n> in some cases.  So I put in a comment of why we don't use the
descriptive name in this case.

I have committed all of the patches in my backlog (dense math registers, other
-mcpu=future instructions, random bug fixes, support for _Float16 and
__bfloat16, and optimizations for vector logical operations on power10/power11)
into the IBM vendor branch:

        vendors/ibm/gcc-17-future

I have tested these patches on both big endian and little endian PowerPC
servers, with no regressions.  Can I check these patches into the trunk?

2026-07-02  Michael Meissner  <[email protected]>

gcc/

        * config/rs6000/rs6000.cc (alt_reg_names): Use %dm<n> for dense math
        registers, not %dmr<n>.
        (print_operand): Add a comment for %A<n>, of why we can't emit %dm<n>
        since the assembler doesn't recognize %dm0 in this context.
---
 gcc/config/rs6000/rs6000.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index d8ce482ca0f..7220c6d9b27 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -1259,7 +1259,7 @@ static const char alt_reg_names[][8] =
   /* vrsave vscr sfp */
   "vrsave", "vscr", "sfp",
   /* dense math registers.  */
-  "%dmr0", "%dmr1", "%dmr2", "%dmr3", "%dmr4", "%dmr5", "%dmr6", "%dmr7",
+  "%dm0", "%dm1", "%dm2", "%dm3", "%dm4", "%dm5", "%dm6", "%dm7",
 };
 #endif
 
@@ -14280,6 +14280,10 @@ print_operand (FILE *file, rtx x, int code)
         accumulators overlapping with the FPR registers.  */
       if (!REG_P (x))
        output_operand_lossage ("invalid %%A value");
+
+      /* We can't use reg_names[REGNO (x)] here because the assembler doesn't
+        recognize things list dmxvf64gerpp %dm6,%vs32,%vs40.  We continue to
+        just put out a number 0..7.  */
       else if (TARGET_DENSE_MATH && DMF_REGNO_P (REGNO (x)))
        fprintf (file, "%d", REGNO (x) - FIRST_DMF_REGNO);
       else if (!FP_REGNO_P (REGNO (x)) || (REGNO (x) % 4) != 0)
-- 
2.54.0


-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: [email protected]

Reply via email to