]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Convert LEA stack adjust insn to SUB when FLAGS_REG is dead
authorUros Bizjak <ubizjak@gmail.com>
Tue, 24 Jun 2025 09:02:02 +0000 (11:02 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Tue, 24 Jun 2025 16:48:04 +0000 (18:48 +0200)
commit8f5fac56ca39e99d7a9ad6a0c067c75e6ffcd2cf
treed8c0f8d55c36e0af07a7cd498d9be38e2facec75
parent63076dbe21535cc7cf106d92f655e2b7d8b749cc
i386: Convert LEA stack adjust insn to SUB when FLAGS_REG is dead

ADD/SUB is faster than LEA for most processors. Also, there are
several peephole2 patterns available that convert prologue esp
subtractions to pushes (at the end of i386.md). These process only
patterns with flags reg clobber, so they are ineffective
with clobber-less stack ptr adjustments, introduced by r16-1551
("x86: Enable separate shrink wrapping").

Introduce a peephole2 pattern that adds a clobber to a clobber-less
stack ptr adjustments when FLAGS_REG is dead.

gcc/ChangeLog:

* config/i386/i386.md
(@pro_epilogue_adjust_stack_add_nocc<mode>): Add type attribute.
(pro_epilogue_adjust_stack_add_nocc peephole2 pattern):
Convert pro_epilogue_adjust_stack_add_nocc variant to
pro_epilogue_adjust_stack_add when FLAGS_REG is dead.
gcc/config/i386/i386.md