From 37816988909ba2b10722aff56d7cbd8ff48bf21d Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Mon, 29 Jul 2019 19:21:18 +0000 Subject: [PATCH] Allow both upper and lower case 'r' in register names 2019-07-29 Jozef Lawrynowicz PR target/70320 * config/msp430/msp430.h: Define ADDITIONAL_REGISTER_NAMES. 2019-07-29 Jozef Lawrynowicz PR target/70320 * gcc.target/msp430/asm-register-names-lower-case.c: New test. * gcc.target/msp430/asm-register-names-upper-case.c: Likewise. From-SVN: r273883 --- gcc/ChangeLog | 5 ++++ gcc/config/msp430/msp430.h | 22 ++++++++++++++++ gcc/testsuite/ChangeLog | 6 +++++ .../msp430/asm-register-names-lower-case.c | 25 +++++++++++++++++++ .../msp430/asm-register-names-upper-case.c | 25 +++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 gcc/testsuite/gcc.target/msp430/asm-register-names-lower-case.c create mode 100644 gcc/testsuite/gcc.target/msp430/asm-register-names-upper-case.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bec9aeb6f40..89faa5288eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-07-29 Jozef Lawrynowicz + + PR target/70320 + * config/msp430/msp430.h: Define ADDITIONAL_REGISTER_NAMES. + 2019-07-29 Richard Sandiford PR middle-end/91242 diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h index f952d15e7ff..5b91c83cbcd 100644 --- a/gcc/config/msp430/msp430.h +++ b/gcc/config/msp430/msp430.h @@ -225,6 +225,28 @@ extern const char * msp430_select_hwmult_lib (int, const char **); "argptr" \ } +/* Allow lowercase "r" to be used in register names instead of upper + case "R". */ +#define ADDITIONAL_REGISTER_NAMES \ +{ \ + { "r0", 0 }, \ + { "r1", 1 }, \ + { "r2", 2 }, \ + { "r3", 3 }, \ + { "r4", 4 }, \ + { "r5", 5 }, \ + { "r6", 6 }, \ + { "r7", 7 }, \ + { "r8", 8 }, \ + { "r9", 9 }, \ + { "r10", 10 }, \ + { "r11", 11 }, \ + { "r12", 12 }, \ + { "r13", 13 }, \ + { "r14", 14 }, \ + { "r15", 15 } \ +} + enum reg_class { NO_REGS, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3879924487..a52d10878dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-07-29 Jozef Lawrynowicz + + PR target/70320 + * gcc.target/msp430/asm-register-names-lower-case.c: New test. + * gcc.target/msp430/asm-register-names-upper-case.c: Likewise. + 2019-07-29 Martin Liska * g++.dg/cpp1y/new1.C (test_unused): Add new case that causes diff --git a/gcc/testsuite/gcc.target/msp430/asm-register-names-lower-case.c b/gcc/testsuite/gcc.target/msp430/asm-register-names-lower-case.c new file mode 100644 index 00000000000..98e39298484 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/asm-register-names-lower-case.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-rtl-expand" } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R4" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R5" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R6" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R7" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R8" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R9" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R10" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R11" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R12" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R13" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R14" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R15" expand } } */ + +/* PR target/70320 + Check that a lower case "r" in register names is accepted in + an asm statement clobber list. */ + +void +foo (void) +{ + __asm__ ("" : : : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", + "r13", "r14", "r15"); +} diff --git a/gcc/testsuite/gcc.target/msp430/asm-register-names-upper-case.c b/gcc/testsuite/gcc.target/msp430/asm-register-names-upper-case.c new file mode 100644 index 00000000000..bd4edc01270 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/asm-register-names-upper-case.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-rtl-expand" } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R4" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R5" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R6" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R7" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R8" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R9" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R10" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R11" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R12" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R13" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R14" expand } } */ +/* { dg-final { scan-rtl-dump "(?n)clobber.*R15" expand } } */ + +/* PR target/70320 + Check that an upper case "r" in register names is accepted in + an asm statement clobber list. */ + +void +foo (void) +{ + __asm__ ("" : : : "R4", "R5", "R6", "R7", "R8", "R9", "R10", "R11", "R12", + "R13", "R14", "R15"); +} -- 2.30.2