diff options
author | Dimitar Dimitrov <dimitar@dinux.eu> | 2024-12-08 11:37:06 +0200 |
---|---|---|
committer | Dimitar Dimitrov <dimitar@dinux.eu> | 2024-12-08 12:51:04 +0200 |
commit | 89d19ab91a167c4c2258cc6c9fa7dd448c007ab7 (patch) | |
tree | 0c8a8f055193ed99aa652f9ee99ee61f5d93bb9d /gcc | |
parent | e119083466e69ff1c5a6685b45b6f819de5e1cd3 (diff) | |
download | gcc-89d19ab91a167c4c2258cc6c9fa7dd448c007ab7.zip gcc-89d19ab91a167c4c2258cc6c9fa7dd448c007ab7.tar.gz gcc-89d19ab91a167c4c2258cc6c9fa7dd448c007ab7.tar.bz2 |
pru: Implement c and n asm operand modifiers
Fix c-c++-common/toplevel-asm-1.c failure for PRU backend, caused by
missing implementation of the "c" asm operand modifier.
gcc/ChangeLog:
* config/pru/pru.cc (pru_print_operand): Implement c and n
inline assembly operand modifiers.
gcc/testsuite/ChangeLog:
* gcc.target/pru/asm-op-modifier.c: New test.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/pru/pru.cc | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/pru/asm-op-modifier.c | 32 |
2 files changed, 43 insertions, 1 deletions
diff --git a/gcc/config/pru/pru.cc b/gcc/config/pru/pru.cc index 3b9ab36..5dd6391 100644 --- a/gcc/config/pru/pru.cc +++ b/gcc/config/pru/pru.cc @@ -1858,12 +1858,22 @@ pru_print_operand (FILE *file, rtx op, int letter) fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (op) & 0xff); return; } + else if (letter == 'c') + { + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (op)); + return; + } + else if (letter == 'n') + { + fprintf (file, HOST_WIDE_INT_PRINT_DEC, -INTVAL (op)); + return; + } /* Else, fall through. */ case CONST: case LABEL_REF: case SYMBOL_REF: - if (letter == 0) + if (letter == 0 || letter == 'c') { output_addr_const (file, op); return; diff --git a/gcc/testsuite/gcc.target/pru/asm-op-modifier.c b/gcc/testsuite/gcc.target/pru/asm-op-modifier.c new file mode 100644 index 0000000..6ace031 --- /dev/null +++ b/gcc/testsuite/gcc.target/pru/asm-op-modifier.c @@ -0,0 +1,32 @@ +/* Test ASM operand modifiers. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +struct S { + char b; + int a; + short c; +}; + +void +test_const_int (void) +{ + /* { dg-final { scan-assembler "# printing 7 and -5" } } */ + asm volatile ("# printing %c0 and %n1" + : : + "i" (sizeof(struct S)), + "i" (__builtin_offsetof (struct S, c))); +} + +extern int g; + +void +test_sym (void) +{ + /* { dg-final { scan-assembler "# outputting g and test_sym" } } */ + asm volatile ("# outputting %c0 and %c1" + : : + "i" (&g), + "i" (&test_sym)); +} |