On 10/5/23 13:26, Richard Earnshaw wrote:
On 03/10/2023 16:18, Victor Do Nascimento wrote:
Motivated by the need to print system register names in output
assembly, this patch adds the required logic to
`aarch64_print_operand' to accept rtxs of type CONST_STRING and
process these accordingly.
Consequently, an rtx such as:
(set (reg/i:DI 0 x0)
(unspec:DI [(const_string ("amcgcr_el0"))])
can now be output correctly using the following output pattern when
composing `define_insn's:
"mrs\t%x0, %1"
gcc/ChangeLog
* gcc/config/aarch64/aarch64.cc (aarch64_print_operand): Add
support for CONST_STRING.
---
gcc/config/aarch64/aarch64.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/config/aarch64/aarch64.cc
b/gcc/config/aarch64/aarch64.cc
index dd5ac1cbc8d..d6dd0586ac1 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -12400,6 +12400,12 @@ aarch64_print_operand (FILE *f, rtx x, int code)
switch (GET_CODE (x))
{
+ case CONST_STRING:
+ {
+ const char *output_op = XSTR (x, 0);
+ asm_fprintf (f, "%s", output_op);
+ break;
+ }
case REG:
if (aarch64_sve_data_mode_p (GET_MODE (x)))
{
Didn't we discuss (off list) always printing out the generic register
names, so that there was less dependency on having a specific assembler
version that knows about newer sysregs?
R.
That's right, Richard.
We did settle on generic register names.
The example above is unfortunate and can, nay should, be amended to be
less misleading.
It's not wrong to say that an rtx such as
>> (set (reg/i:DI 0 x0)
>> (unspec:DI [(const_string ("amcgcr_el0"))])
would now be understood by the `aarch64_print_operand' function, but
we'd never see that being generated as a result of this work.
For "amcgcr_el0" what we'd expect to see reaching the back-end is, in
fact, the following:
(set (reg/i:DI 0 x0)
(unspec:DI [(const_string ("s3_3_c13_c2_2"))])
Thanks for picking up on this and bringing it to my attention!
V.