https://gcc.gnu.org/g:13ec1769fa2404eec8c34ce8e0b87fc28ff5ac76

commit r16-3799-g13ec1769fa2404eec8c34ce8e0b87fc28ff5ac76
Author: Xi Ruoyao <[email protected]>
Date:   Tue Aug 19 11:14:42 2025 +0800

    LoongArch: Fix the "%t" modifier handling for (const_int 0)
    
    This modifier is intended to output $r0 for (const_int 0), but the
    logic:
    
    GET_MODE (op) != TImode || (op != CONST0_RTX (TImode) && code != REG)
    
    will reject (const_int 0) because (const_int 0) actually does not have
    a mode and GET_MODE will return VOIDmode for it.
    
    Use reg_or_0_operand instead to fix the issue.
    
    gcc/ChangeLog:
    
            * config/loongarch/loongarch.cc (loongarch_print_operand): Call
            reg_or_0_operand for checking the sanity of %t.

Diff:
---
 gcc/config/loongarch/loongarch.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index 0935d7ba0925..ef5d5f4e0605 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6495,8 +6495,7 @@ loongarch_print_operand (FILE *file, rtx op, int letter)
       break;
 
     case 't':
-      if (GET_MODE (op) != TImode
-         || (op != CONST0_RTX (TImode) && code != REG))
+      if (!reg_or_0_operand (op, TImode))
        {
          output_operand_lossage ("invalid use of '%%%c'", letter);
          break;

Reply via email to