public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Replace UNSPEC_FCOPYSIGN with copysign RTL
@ 2023-10-03  3:46 Xi Ruoyao
  2023-10-04  4:04 ` chenglulu
  0 siblings, 1 reply; 2+ messages in thread
From: Xi Ruoyao @ 2023-10-03  3:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: chenglulu, i, xuchenghua, Xi Ruoyao

When I added copysign support for LoongArch (r13-3702), we did not have
a copysign RTL insn, so I had to use UNSPEC to represent the copysign
instruction. Now the copysign RTX code has been added in r14-1586, so
this patch removes those UNSPECs, and it uses the native RTL copysign
insn.

Inspired by rs6000 patch "Cleanup: Replace UNSPEC_COPYSIGN with copysign
RTL" [1] from Michael Meissner.

[1]: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631701.html

gcc/ChangeLog:

	* config/loongarch/loongarch.md (UNSPEC_FCOPYSIGN): Delete.
	(copysign<mode>3): Use copysign RTL instead of UNSPEC.
---

Bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?

 gcc/config/loongarch/loongarch.md | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
index 2b09209945b..9916c741641 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -37,7 +37,6 @@ (define_c_enum "unspec" [
   UNSPEC_FCLASS
   UNSPEC_FMAX
   UNSPEC_FMIN
-  UNSPEC_FCOPYSIGN
   UNSPEC_FTINT
   UNSPEC_FTINTRM
   UNSPEC_FTINTRP
@@ -1130,9 +1129,8 @@ (define_insn "abs<mode>2"
 
 (define_insn "copysign<mode>3"
   [(set (match_operand:ANYF 0 "register_operand" "=f")
-	(unspec:ANYF [(match_operand:ANYF 1 "register_operand" "f")
-		      (match_operand:ANYF 2 "register_operand" "f")]
-		     UNSPEC_FCOPYSIGN))]
+	(copysign:ANYF (match_operand:ANYF 1 "register_operand" "f")
+		       (match_operand:ANYF 2 "register_operand" "f")))]
   "TARGET_HARD_FLOAT"
   "fcopysign.<fmt>\t%0,%1,%2"
   [(set_attr "type" "fcopysign")
-- 
2.42.0


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

* Re: [PATCH] LoongArch: Replace UNSPEC_FCOPYSIGN with copysign RTL
  2023-10-03  3:46 [PATCH] LoongArch: Replace UNSPEC_FCOPYSIGN with copysign RTL Xi Ruoyao
@ 2023-10-04  4:04 ` chenglulu
  0 siblings, 0 replies; 2+ messages in thread
From: chenglulu @ 2023-10-04  4:04 UTC (permalink / raw)
  To: Xi Ruoyao, gcc-patches; +Cc: i, xuchenghua

LGTM!

Thanks!

在 2023/10/3 上午11:46, Xi Ruoyao 写道:
> When I added copysign support for LoongArch (r13-3702), we did not have
> a copysign RTL insn, so I had to use UNSPEC to represent the copysign
> instruction. Now the copysign RTX code has been added in r14-1586, so
> this patch removes those UNSPECs, and it uses the native RTL copysign
> insn.
>
> Inspired by rs6000 patch "Cleanup: Replace UNSPEC_COPYSIGN with copysign
> RTL" [1] from Michael Meissner.
>
> [1]: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631701.html
>
> gcc/ChangeLog:
>
> 	* config/loongarch/loongarch.md (UNSPEC_FCOPYSIGN): Delete.
> 	(copysign<mode>3): Use copysign RTL instead of UNSPEC.
> ---
>
> Bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?
>
>   gcc/config/loongarch/loongarch.md | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
> index 2b09209945b..9916c741641 100644
> --- a/gcc/config/loongarch/loongarch.md
> +++ b/gcc/config/loongarch/loongarch.md
> @@ -37,7 +37,6 @@ (define_c_enum "unspec" [
>     UNSPEC_FCLASS
>     UNSPEC_FMAX
>     UNSPEC_FMIN
> -  UNSPEC_FCOPYSIGN
>     UNSPEC_FTINT
>     UNSPEC_FTINTRM
>     UNSPEC_FTINTRP
> @@ -1130,9 +1129,8 @@ (define_insn "abs<mode>2"
>   
>   (define_insn "copysign<mode>3"
>     [(set (match_operand:ANYF 0 "register_operand" "=f")
> -	(unspec:ANYF [(match_operand:ANYF 1 "register_operand" "f")
> -		      (match_operand:ANYF 2 "register_operand" "f")]
> -		     UNSPEC_FCOPYSIGN))]
> +	(copysign:ANYF (match_operand:ANYF 1 "register_operand" "f")
> +		       (match_operand:ANYF 2 "register_operand" "f")))]
>     "TARGET_HARD_FLOAT"
>     "fcopysign.<fmt>\t%0,%1,%2"
>     [(set_attr "type" "fcopysign")


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

end of thread, other threads:[~2023-10-04  4:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03  3:46 [PATCH] LoongArch: Replace UNSPEC_FCOPYSIGN with copysign RTL Xi Ruoyao
2023-10-04  4:04 ` chenglulu

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).