]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: Allow to share libgcc's __negsi2.
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 29 Jan 2025 17:21:07 +0000 (18:21 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Wed, 29 Jan 2025 17:25:39 +0000 (18:25 +0100)
libgcc has a module for __negsi2:  REG_22:SI := - REG_22:SI.
This patch adds a pattern that allows to share that function
provided optimize_size.

gcc/
* config/avr/avr.md (*negsi2.libgcc): New insn.

gcc/config/avr/avr.md

index 1c956114a4b87b196b3f7e06f26deb01291524bb..06e31aa7d72d13aacff5cf3f2d7eebb1537658bb 100644 (file)
   ""
   [(set_attr "isa" "*,*,mov,movw")])
 
+(define_insn "*negsi2.libgcc"
+  [(set (reg:SI REG_22)
+        (neg:SI (reg:SI REG_22)))
+   (clobber (reg:CC REG_CC))]
+  "reload_completed
+   && optimize_size"
+  "%~call __negsi2"
+  [(set_attr "type" "xcall")])
+
 (define_insn "*negsi2"
   [(set (match_operand:SI 0 "register_operand"       "=!d,r,&r,&r")
         (neg:SI (match_operand:SI 1 "register_operand" "0,0,r ,r")))