[MSP430] Allow lower-case "r" to be used in register names by defining ADDITIONAL_REGISTER_NAMES (PR target/70320)

Message ID 20190723135003.06a066fa@jozef-kubuntu
State New
Headers show
Series
  • [MSP430] Allow lower-case "r" to be used in register names by defining ADDITIONAL_REGISTER_NAMES (PR target/70320)
Related show

Commit Message

Jozef Lawrynowicz July 23, 2019, 12:50 p.m.
The attached patch enables a lower-case "r" to be used in register names
specified in asm statements clobber list or command line options, in addition to
the upper case "R" that is currently supported.

Successfully regtested on trunk for msp430-elf.

Ok for trunk?

Comments

Jeff Law July 24, 2019, 3:32 p.m. | #1
On 7/23/19 6:50 AM, Jozef Lawrynowicz wrote:
> The attached patch enables a lower-case "r" to be used in register names

> specified in asm statements clobber list or command line options, in addition to

> the upper case "R" that is currently supported.

> 

> Successfully regtested on trunk for msp430-elf.

> 

> Ok for trunk?

> 

> 

> 0001-MSP430-additional-register.patch

> 

> From d639b2ba7d4a93d790bde3ad55df751116eab04b Mon Sep 17 00:00:00 2001

> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>

> Date: Mon, 22 Jul 2019 10:35:43 +0100

> Subject: [PATCH] MSP430 additional register

> 

> gcc/ChangeLog:

> 

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

> 

> 	PR target/70320

> 	* config/msp430/msp430.h: Define ADDITIONAL_REGISTER_NAMES.

> 

> gcc/testsuite/ChangeLog:

> 

> 2019-07-23  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.

OK
jeff

Patch

From d639b2ba7d4a93d790bde3ad55df751116eab04b Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 22 Jul 2019 10:35:43 +0100
Subject: [PATCH] MSP430 additional register

gcc/ChangeLog:

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

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

gcc/testsuite/ChangeLog:

2019-07-23  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.
---
 gcc/config/msp430/msp430.h                    | 22 ++++++++++++++++
 .../msp430/asm-register-names-lower-case.c    | 25 +++++++++++++++++++
 .../msp430/asm-register-names-upper-case.c    | 25 +++++++++++++++++++
 3 files changed, 72 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/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
index 1288b1a263d..f97cbec8d21 100644
--- a/gcc/config/msp430/msp430.h
+++ b/gcc/config/msp430/msp430.h
@@ -224,6 +224,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/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..b417a8c5df4
--- /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 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");
+}
-- 
2.17.1