Allow both upper and lower case 'r' in register names
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Mon, 29 Jul 2019 19:21:18 +0000 (19:21 +0000)
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>
Mon, 29 Jul 2019 19:21:18 +0000 (19:21 +0000)
2019-07-29  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

PR target/70320
* config/msp430/msp430.h: Define ADDITIONAL_REGISTER_NAMES.

2019-07-29  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

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
gcc/config/msp430/msp430.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/msp430/asm-register-names-lower-case.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/asm-register-names-upper-case.c [new file with mode: 0644]

index bec9aeb6f40a78eacb74dd1b4f2376c717e02af2..89faa5288eb4b10116fd772fc862a7b9313d6b92 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-29  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       PR target/70320
+       * config/msp430/msp430.h: Define ADDITIONAL_REGISTER_NAMES.
+
 2019-07-29  Richard Sandiford  <richard.sandiford@arm.com>
 
        PR middle-end/91242
index f952d15e7ffdf4798a540a5893ab09ac82a8d4da..5b91c83cbcd08befaea492308f62f2bf7b23b467 100644 (file)
@@ -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,
index e387992448766b0772712dea80b3203c0bdc3169..a52d10878dc67a40af58aa916f031a78cd82c46d 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-29  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       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  <mliska@suse.cz>
 
        * 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 (file)
index 0000000..98e3929
--- /dev/null
@@ -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 (file)
index 0000000..bd4edc0
--- /dev/null
@@ -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");
+}