]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Allow printing symbolic name with "%c" in inline asm
authorXi Ruoyao <xry111@xry111.site>
Fri, 1 May 2026 19:31:09 +0000 (03:31 +0800)
committerXi Ruoyao <xry111@xry111.site>
Fri, 8 May 2026 09:17:36 +0000 (17:17 +0800)
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.

gcc/config/loongarch/loongarch.cc

index fd3791e2455310d151faa625b8fb99590b85a1ca..0831da018ff299bc71ad856eb4368b6994ce3992 100644 (file)
@@ -6756,7 +6756,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);