]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Replace UNSPEC_FCOPYSIGN with copysign RTL
authorXi Ruoyao <xry111@xry111.site>
Mon, 2 Oct 2023 10:51:00 +0000 (18:51 +0800)
committerXi Ruoyao <xry111@xry111.site>
Wed, 4 Oct 2023 09:35:37 +0000 (17:35 +0800)
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.

gcc/config/loongarch/loongarch.md

index 4fcb6d781d5ed05c7e7ee192a85743d49f461418..3286b0c56ae48555e0cadf90a2a4d37b5703ada3 100644 (file)
@@ -37,7 +37,6 @@
   UNSPEC_FCLASS
   UNSPEC_FMAX
   UNSPEC_FMIN
-  UNSPEC_FCOPYSIGN
   UNSPEC_FTINT
   UNSPEC_FTINTRM
   UNSPEC_FTINTRP
 
 (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")