public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] xtensa: Use HARD_REG_SET instead of bare integer
       [not found] <932ef16c-ce43-30a1-d1c0-a4d3af3918e8.ref@yahoo.co.jp>
@ 2023-07-04  0:57 ` Takayuki 'January June' Suwa
  2023-07-04 15:40   ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2023-07-04  0:57 UTC (permalink / raw)
  To: GCC Patches; +Cc: Max Filippov

gcc/ChangeLog:

	* config/xtensa/xtensa.cc (machine_function, xtensa_expand_prologue):
	Change to use HARD_REG_BIT and its macros.
	* config/xtensa/xtensa.md
	(peephole2: regmove elimination during DFmode input reload):
	Likewise.
---
 gcc/config/xtensa/xtensa.cc |  9 +++++----
 gcc/config/xtensa/xtensa.md | 13 ++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index 3298d53493c..992e80d824d 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -107,7 +107,7 @@ struct GTY(()) machine_function
   bool epilogue_done;
   bool inhibit_logues_a1_adjusts;
   rtx last_logues_a9_content;
-  HOST_WIDE_INT eliminated_callee_saved_bmp;
+  HARD_REG_SET eliminated_callee_saved;
 };
 
 static void xtensa_option_override (void);
@@ -3586,7 +3586,8 @@ xtensa_expand_prologue (void)
 		df_insn_rescan (insnS);
 		SET_SRC (PATTERN (insnR)) = copy_rtx (mem);
 		df_insn_rescan (insnR);
-		cfun->machine->eliminated_callee_saved_bmp |= 1 << regno;
+		SET_HARD_REG_BIT (cfun->machine->eliminated_callee_saved,
+				  regno);
 	      }
 	    else
 	      {
@@ -3690,8 +3691,8 @@ xtensa_expand_epilogue (bool sibcall_p)
       for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
 	if (xtensa_call_save_reg(regno))
 	  {
-	    if (! (cfun->machine->eliminated_callee_saved_bmp
-		   & (1 << regno)))
+	    if (! TEST_HARD_REG_BIT (cfun->machine->eliminated_callee_saved,
+				     regno))
 	      {
 		rtx x = gen_rtx_PLUS (Pmode,
 				      stack_pointer_rtx, GEN_INT (offset));
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 664424f1239..5386e45b51d 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -3240,15 +3240,14 @@
    (set (match_dup 3)
 	(match_dup 7))]
 {
-  uint32_t check = 0;
+  HARD_REG_SET regs;
   int i;
+  CLEAR_HARD_REG_SET (regs);
   for (i = 0; i <= 3; ++i)
-    {
-      uint32_t mask = (uint32_t)1 << REGNO (operands[i]);
-      if (check & mask)
-	FAIL;
-      check |= mask;
-    }
+    if (TEST_HARD_REG_BIT (regs, REGNO (operands[i])))
+      FAIL;
+    else
+      SET_HARD_REG_BIT (regs, REGNO (operands[i]));
   operands[6] = gen_rtx_MEM (SFmode, XEXP (operands[6], 0));
   operands[7] = gen_rtx_MEM (SFmode, XEXP (operands[7], 0));
 })
-- 
2.30.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xtensa: Use HARD_REG_SET instead of bare integer
  2023-07-04  0:57 ` [PATCH] xtensa: Use HARD_REG_SET instead of bare integer Takayuki 'January June' Suwa
@ 2023-07-04 15:40   ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2023-07-04 15:40 UTC (permalink / raw)
  To: Takayuki 'January June' Suwa; +Cc: GCC Patches

On Mon, Jul 3, 2023 at 5:57 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.cc (machine_function, xtensa_expand_prologue):
>         Change to use HARD_REG_BIT and its macros.
>         * config/xtensa/xtensa.md
>         (peephole2: regmove elimination during DFmode input reload):
>         Likewise.
> ---
>  gcc/config/xtensa/xtensa.cc |  9 +++++----
>  gcc/config/xtensa/xtensa.md | 13 ++++++-------
>  2 files changed, 11 insertions(+), 11 deletions(-)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-04 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <932ef16c-ce43-30a1-d1c0-a4d3af3918e8.ref@yahoo.co.jp>
2023-07-04  0:57 ` [PATCH] xtensa: Use HARD_REG_SET instead of bare integer Takayuki 'January June' Suwa
2023-07-04 15:40   ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).