https://gcc.gnu.org/g:3b449a723094dbd5ba51e4738a03f3b8f242719b

commit 3b449a723094dbd5ba51e4738a03f3b8f242719b
Author: Kishan Parmar <[email protected]>
Date:   Fri Jul 10 15:35:33 2026 +0530

    rs6000: fix off-by-one in *movtdo which_alternative check
    
    The *movtdo pattern has six alternatives:
      0: wa <- m   (split)
      1: m  <- wa  (split)
      2: wa <- wa  (split)
      3: wD <- wD  (dmmr)
      4: wa <- wD  (split)
      5: wD <- wa  (split)
    
    The output template checked which_alternative == 4 for "dmmr",
    but the DMR<-DMR alternative is 3, not 4.  This caused alternative 3
    to return "#" while the split condition excluded it (requiring at
    least one non-DMR operand), so the unsplit "#" insn survived to the
    final pass and triggered an ICE.

Diff:
---
 gcc/config/rs6000/mma.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md
index c12085fe3f00..2af4582f51a8 100644
--- a/gcc/config/rs6000/mma.md
+++ b/gcc/config/rs6000/mma.md
@@ -606,7 +606,7 @@
    && (gpc_reg_operand (operands[0], TDOmode)
        || gpc_reg_operand (operands[1], TDOmode))"
 {
-  if (which_alternative == 4)
+  if (which_alternative == 3)
     return "dmmr %0,%1";
   else
     return "#";

Reply via email to