RISC-V: Use the X iterator for eh_set_lr_{si,di}

Message ID 20220806194046.19446-1-palmer@rivosinc.com
State New, archived
Headers
Series RISC-V: Use the X iterator for eh_set_lr_{si,di} |

Commit Message

Palmer Dabbelt Aug. 6, 2022, 7:40 p.m. UTC
  These two patterns were independent, but exactly match the semantics of
X.  Replace them with a single paramaterized pattern.  Thanks to Andrew
for pointing this one out over IRC.

gcc/ChangeLog

	* config/riscv/riscv.md (eh_set_lr_<mode>): New pattern.
	(eh_set_lr_si): Remove.
	(eh_set_lr_di): Likewise.
---
No new failures on the Linux multilibs on trunk.
---
 gcc/config/riscv/riscv.md | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
  

Comments

Kito Cheng Aug. 10, 2022, 3:46 p.m. UTC | #1
LGTM, thanks!

On Sun, Aug 7, 2022 at 3:42 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> These two patterns were independent, but exactly match the semantics of
> X.  Replace them with a single paramaterized pattern.  Thanks to Andrew
> for pointing this one out over IRC.
>
> gcc/ChangeLog
>
>         * config/riscv/riscv.md (eh_set_lr_<mode>): New pattern.
>         (eh_set_lr_si): Remove.
>         (eh_set_lr_di): Likewise.
> ---
> No new failures on the Linux multilibs on trunk.
> ---
>  gcc/config/riscv/riscv.md | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
> index 0796f91dd30..11a59f98a9f 100644
> --- a/gcc/config/riscv/riscv.md
> +++ b/gcc/config/riscv/riscv.md
> @@ -2562,16 +2562,10 @@
>  ;; Clobber the return address on the stack.  We can't expand this
>  ;; until we know where it will be put in the stack frame.
>
> -(define_insn "eh_set_lr_si"
> -  [(unspec [(match_operand:SI 0 "register_operand" "r")] UNSPEC_EH_RETURN)
> -   (clobber (match_scratch:SI 1 "=&r"))]
> -  "! TARGET_64BIT"
> -  "#")
> -
> -(define_insn "eh_set_lr_di"
> -  [(unspec [(match_operand:DI 0 "register_operand" "r")] UNSPEC_EH_RETURN)
> -   (clobber (match_scratch:DI 1 "=&r"))]
> -  "TARGET_64BIT"
> +(define_insn "eh_set_lr_<mode>"
> +  [(unspec [(match_operand:X 0 "register_operand" "r")] UNSPEC_EH_RETURN)
> +   (clobber (match_scratch:X 1 "=&r"))]
> +  ""
>    "#")
>
>  (define_split
> --
> 2.34.1
>
  

Patch

diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 0796f91dd30..11a59f98a9f 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -2562,16 +2562,10 @@ 
 ;; Clobber the return address on the stack.  We can't expand this
 ;; until we know where it will be put in the stack frame.
 
-(define_insn "eh_set_lr_si"
-  [(unspec [(match_operand:SI 0 "register_operand" "r")] UNSPEC_EH_RETURN)
-   (clobber (match_scratch:SI 1 "=&r"))]
-  "! TARGET_64BIT"
-  "#")
-
-(define_insn "eh_set_lr_di"
-  [(unspec [(match_operand:DI 0 "register_operand" "r")] UNSPEC_EH_RETURN)
-   (clobber (match_scratch:DI 1 "=&r"))]
-  "TARGET_64BIT"
+(define_insn "eh_set_lr_<mode>"
+  [(unspec [(match_operand:X 0 "register_operand" "r")] UNSPEC_EH_RETURN)
+   (clobber (match_scratch:X 1 "=&r"))]
+  ""
   "#")
 
 (define_split