From: Darius Galis Date: Fri, 6 Nov 2020 18:54:20 +0000 (-0700) Subject: Add PC as control register X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25126a28dbea7f9c7d6e5365929d7f3c9f60cdaf;p=gcc.git Add PC as control register gcc/ * 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. --- diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 151ad39d9f0..dfb4bd42fe5 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,13 @@ rx_expand_builtin_mvtc (tree exp) if (! REG_P (arg2)) arg2 = force_reg (SImode, arg2); + if (INTVAL (arg1) == 1) + { + 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 df08a9e5c3e..6e5c546f4db 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)