Hello,
The following patch is adding the PC control register.
It also updates the __builtin_rx_mvfc() function, since
according to the documentation, the PC register cannot be specified
as dest.
The regression was tested with the following command:
make -k check-gcc RUNTESTFLAGS=--target_board=rx-sim
There were no additionals failures.
Please let me know if this is OK, Thank you!
Darius Galis
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b834a2c..3436c25 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-08-17 Darius Galis <darius.ga...@cyberthorstudios.com>
+
+ * config/rx/rx.md (CTRLREG_PC): Add.
+ * config/rx/rx.c (CTRLREG_PC): Add
+ (rx_expand_builtin_mvtc): Add warning: PC register cannot
+ be used as dest.
+
2020-08-03 Jonathan Wakely <jwak...@redhat.com>
* doc/cpp.texi (Variadic Macros): Use the exact ... token in
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 151ad39..1cc88d9 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -639,6 +639,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
switch (INTVAL (op))
{
case CTRLREG_PSW: fprintf (file, "psw"); break;
+ case CTRLREG_PC: fprintf (file, "pc"); break;
case CTRLREG_USP: fprintf (file, "usp"); break;
case CTRLREG_FPSW: fprintf (file, "fpsw"); break;
case CTRLREG_BPSW: fprintf (file, "bpsw"); break;
@@ -2474,6 +2475,14 @@ rx_expand_builtin_mvtc (tree exp)
if (! REG_P (arg2))
arg2 = force_reg (SImode, arg2);
+ if (INTVAL(arg1) == 1/*PC*/)
+ {
+ warning (0, "invalid control register for mvtc : %d - using 'psw'",
+ (int) INTVAL (arg1));
+ arg1 = const0_rtx;
+ }
+
+
emit_insn (gen_mvtc (arg1, arg2));
return NULL_RTX;
diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md
index df08a9e..0739f58 100644
--- a/gcc/config/rx/rx.md
+++ b/gcc/config/rx/rx.md
@@ -77,6 +77,7 @@
(UNSPEC_PID_ADDR 52)
(CTRLREG_PSW 0)
+ (CTRLREG_PC 1)
(CTRLREG_USP 2)
(CTRLREG_FPSW 3)
(CTRLREG_BPSW 8)
--
Ing. Darius GaliČ™
Software Engineer - CyberTHOR Studios Ltd.