Re: [PATCH] RX add control register PC

2020-11-06 Thread Jeff Law via Gcc-patches


On 8/26/20 4:24 AM, Darius Galis wrote:
> Hello,
> Thank you for adjusting the patch.
> I don't have commit privileges, so if you could please commit it, that would 
> be great.

Sorry it took so long.  I got pulled away for most of the last few months.


It's committed to the trunk.


jeff




Re: Ping [PATCH] RX add control register PC

2020-09-28 Thread Darius Galis

Hello,

Could you please let me know the status of this patch?

Thank you,

Darius Galis

On 26-Aug-20 1:24 PM, Darius Galis wrote:

Hello,
Thank you for adjusting the patch.
I don't have commit privileges, so if you could please commit it, that would be 
great.
Best regards,
Darius Galis
On 25-Aug-20 10:48 PM, Jeff Law wrote:

On Tue, 2020-08-18 at 16:05 +0300, Darius Galis wrote:

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
+
+   * 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
   
   	* 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*/)

We generally avoid comments on the same line as code.  And there should be a
space before the open paren of a function or macro argument.  So:

/* PC */
if (INTVAL (arg1) == 1)

With that change, this is OK to commit.  I can't recall if you have commit privs
or not...  If not, I can commit for you.


Thanks,
Jeff


--
Ing. Darius Galiș
Software Engineer - CyberTHOR Studios Ltd.


--
Ing. Darius Galiș
Software Engineer - CyberTHOR Studios Ltd.



Re: [PATCH] RX add control register PC

2020-08-26 Thread Darius Galis

Hello,

Thank you for adjusting the patch.

I don't have commit privileges, so if you could please commit it, that would be 
great.

Best regards,
Darius Galis

On 25-Aug-20 10:48 PM, Jeff Law wrote:

On Tue, 2020-08-18 at 16:05 +0300, Darius Galis wrote:

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  
+
+   * 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  
   
   	* 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*/)

We generally avoid comments on the same line as code.  And there should be a
space before the open paren of a function or macro argument.  So:

/* PC */
if (INTVAL (arg1) == 1)

With that change, this is OK to commit.  I can't recall if you have commit privs
or not...  If not, I can commit for you.


Thanks,
Jeff


--
Ing. Darius Galiș
Software Engineer - CyberTHOR Studios Ltd.



Re: [PATCH] RX add control register PC

2020-08-25 Thread Jeff Law via Gcc-patches
On Tue, 2020-08-18 at 16:05 +0300, Darius Galis wrote:
> 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  
> +
> + * 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  
>   
>   * 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*/)

We generally avoid comments on the same line as code.  And there should be a
space before the open paren of a function or macro argument.  So:

/* PC */
if (INTVAL (arg1) == 1)

With that change, this is OK to commit.  I can't recall if you have commit privs
or not...  If not, I can commit for you.


Thanks,
Jeff



[PATCH] RX add control register PC

2020-08-18 Thread Darius Galis

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  
+
+   * 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  
 
 	* 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_USP2)
(CTRLREG_FPSW   3)
(CTRLREG_BPSW   8)

--
Ing. Darius Galiș
Software Engineer - CyberTHOR Studios Ltd.