https://gcc.gnu.org/g:516eb13f439a19984981a20bf6d1503a97b9b7b8

commit 516eb13f439a19984981a20bf6d1503a97b9b7b8
Author: Jeevitha <[email protected]>
Date:   Tue Jul 14 23:29:08 2026 -0500

    rs6000: Add %W print modifier
    
    Add a new %W print modifier to print_operand that prints the VSX
    register number plus two.
    
    Some future Power instruction patterns require printing two VSX
    registers corresponding to a __vector_pair operand. The existing
    %x print modifier emits the first VSX register using VSX register
    numbering. Add a new %W print modifier to emit the second VSX
    register of the pair.
    
    2025-07-13  Jeevitha Palanisamy  <[email protected]>
                Kishan Parmar  <[email protected]>
    
    gcc/
            * config/rs6000/rs6000.cc (print_operand): Add the `%W`
            print modifier to print the VSX register number plus two.

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

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 7743c9cdc4a1..64683102e9e6 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -14527,6 +14527,27 @@ print_operand (FILE *file, rtx x, int code)
                         ? reg - 32
                         : reg - FIRST_ALTIVEC_REGNO + 32);
 
+#ifdef TARGET_REGNAMES
+         if (TARGET_REGNAMES)
+           fprintf (file, "%%vs%d", vsx_reg);
+         else
+#endif
+           fprintf (file, "%d", vsx_reg);
+       }
+      return;
+
+    case 'W':
+      /* Like '%x', but prints the VSX register number +2.  */
+      if (!REG_P (x) || !VSX_REGNO_P (REGNO (x)))
+       output_operand_lossage ("invalid %%W value");
+      else
+       {
+         int reg = REGNO (x);
+         int vsx_reg = (FP_REGNO_P (reg)
+                        ? reg - 32
+                        : reg - FIRST_ALTIVEC_REGNO + 32);
+         vsx_reg += 2;
+
 #ifdef TARGET_REGNAMES
          if (TARGET_REGNAMES)
            fprintf (file, "%%vs%d", vsx_reg);

Reply via email to