]> gcc.gnu.org Git - gcc.git/commitdiff
AVR: Use rtx code copysign.
authorGeorg-Johann Lay <avr@gjlay.de>
Sat, 14 Sep 2024 08:12:54 +0000 (10:12 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Sat, 14 Sep 2024 12:54:06 +0000 (14:54 +0200)
gcc/
* config/avr/avr.md (UNSPEC_COPYSIGN): Remove define_enum.
(copysignsf3): Use copysign instead of UNSPEC_COPYSIGN.
Allow const_double for operand 2.

gcc/config/avr/avr.md

index 429f537b7d4f7c26bb0e2cfc1ff3c10fac0d40dd..2abf3c38d83657fc2ba6bed78a8cb6addb146047 100644 (file)
@@ -87,7 +87,6 @@
    UNSPEC_FMUL
    UNSPEC_FMULS
    UNSPEC_FMULSU
-   UNSPEC_COPYSIGN
    UNSPEC_INSERT_BITS
    UNSPEC_ROUND
    ])
 ;; Copysign
 
 (define_insn "copysignsf3"
-  [(set (match_operand:SF 0 "register_operand"             "=r")
-        (unspec:SF [(match_operand:SF 1 "register_operand"  "0")
-                    (match_operand:SF 2 "register_operand"  "r")]
-                   UNSPEC_COPYSIGN))]
+  [(set (match_operand:SF 0 "register_operand"              "=r")
+        (copysign:SF (match_operand:SF 1 "register_operand"  "0")
+                     (match_operand:SF 2 "nonmemory_operand" "rF")))]
   ""
-  "bst %D2,7\;bld %D0,7"
+  {
+    if (const_double_operand (operands[2], SFmode))
+      {
+        rtx xmsb = simplify_gen_subreg (QImode, operands[2], SFmode, 3);
+        return INTVAL (xmsb) < 0 ? "set\;bld %D0,7" : "clt\;bld %D0,7";
+      }
+    return "bst %D2,7\;bld %D0,7";
+  }
   [(set_attr "length" "2")])
 
 ;; Swap Bytes (change byte-endianness)
This page took 0.0702700000000001 seconds and 5 git commands to generate.