https://gcc.gnu.org/g:130042c7c70664cba644ef9bc9a1bf7a04c83727

commit r16-8901-g130042c7c70664cba644ef9bc9a1bf7a04c83727
Author: Xi Ruoyao <[email protected]>
Date:   Sat May 2 03:31:09 2026 +0800

    LoongArch: Allow printing symbolic name with "%c" in inline asm
    
    The gcc.dg/ipa/pr122458.c test relies on this.  The doc says "%c" is
    for "constant operand" and I think there's no harm to consider symbolic
    name a constant operand.
    
    gcc/
    
            * config/loongarch/loongarch.cc (loongarch_print_operand): Print
            the symbol name for SYMBOL_REF with %c.
    
    (cherry picked from commit 363b9485ad4475bc2b20219188fba054a72f051d)

Diff:
---
 gcc/config/loongarch/loongarch.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index 4a0a9bafa813..23d000bc0b34 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6755,7 +6755,9 @@ loongarch_print_operand (FILE *file, rtx op, int letter)
 
 
     case 'c':
-      if (CONST_INT_P (op))
+      if (SYMBOL_REF_P (op))
+       output_addr_const (asm_out_file, op);
+      else if (CONST_INT_P (op))
        fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (op));
       else
        output_operand_lossage ("unsupported operand for code '%c'", letter);

Reply via email to