https://gcc.gnu.org/g:eacb85eb24c381e38a76d3ad9b2d678c29c171f5
commit r15-7276-geacb85eb24c381e38a76d3ad9b2d678c29c171f5 Author: Georg-Johann Lay <a...@gjlay.de> Date: Wed Jan 29 18:21:07 2025 +0100 AVR: Allow to share libgcc's __negsi2. 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. Diff: --- gcc/config/avr/avr.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 1c956114a4b8..06e31aa7d72d 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -6299,6 +6299,15 @@ "" [(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")))