From eacb85eb24c381e38a76d3ad9b2d678c29c171f5 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Wed, 29 Jan 2025 18:21:07 +0100 Subject: [PATCH] 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. --- 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 1c956114a4b..06e31aa7d72 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"))) -- 2.47.2