Documentation is pretty clear here: "Require a constant operand and
print the constant expression with no punctuation." IOW any integer
value of whatever magnitude or sign ought to be acceptable.
---
RFC: If this (doing the change in generic code) is the way to go, in a
     few cases arch-specific code can (or even needs to be, e.g. Arm32)
     cleaned up. Alternatively arch-specific code needs to learn to deal
     with 'c' (at least x86 and RISC-V, just from code inspection also
     ia64, and I didn't check many others that I'm not familiar with at
     all).

The differences in what CONSTANT_ADDRESS_P() expands to are perplexing:
It goes from e.g. ia64 not permitting anything to PPC covering
CONST_INT_P() there as well. As CONSTANT_ADDRESS_P() is used in other
places too, CONST_INT_P() uses in its expansion likely can't be dropped
(unless they're there _just_ for this purpose).

My interpretation of the doc goes even further: Extended integer values
ought to be okay, too. Yet since floating point (and alike) values
aren't excluded either, that's somewhat ambiguous.

--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -3506,7 +3506,10 @@ output_asm_insn (const char *templ, rtx
              output_address (VOIDmode, operands[opnum]);
            else if (letter == 'c')
              {
-               if (CONSTANT_ADDRESS_P (operands[opnum]))
+               if (CONST_INT_P (operands[opnum]))
+                 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC,
+                          INTVAL (operands[opnum]));
+               else if (CONSTANT_ADDRESS_P (operands[opnum]))
                  output_addr_const (asm_out_file, operands[opnum]);
                else
                  output_operand (operands[opnum], 'c');

Reply via email to