]> git.ipfire.org Git - thirdparty/gcc.git/commit
arm: Fix missed CE optimization for armv8.1-m.main [PR 116444]
authorAndre Vieira <andre.simoesdiasvieira@arm.com>
Fri, 4 Oct 2024 12:43:46 +0000 (13:43 +0100)
committerAndre Vieira <andre.simoesdiasvieira@arm.com>
Fri, 4 Oct 2024 12:46:13 +0000 (13:46 +0100)
commit7766a2c1eb683eeee352ce117e8ed014665f392f
treeff20e324233a150c9cb11f6648c813f25b7cfcb7
parent16cd00a10035992f52ed67ff77eab20039555b03
arm: Fix missed CE optimization for armv8.1-m.main [PR 116444]

This patch restores missed optimizations for armv8.1-m.main targets that were
missed when the generation of csinc, csinv and csneg were enabled for the same
with patch series containing:

commit c2bb84be4a6e581bbf45891457ee632a07416982
Author: Sudi Das <sudi.das@arm.com>
Date:   Fri Sep 18 15:47:46 2020 +0100

    [PATCH 2/5][Arm] New pattern for CSINV instructions

The original patch series makes use of the "noce" machinery to transform RTL
into patterns that later match the Armv8.1-M Mainline, by getting the target
hook TARGET_HAVE_CONDITIONAL_EXECUTION, to return FALSE for such targets prior
to reload_completed.  The same machinery however was transforming other RTL
patterns which were later on causing the "ce" pass post reload_completed to no
longer optimize conditional execution opportunities, which was causing the
regression observed in PR target/116444, a regression of 'testsuite/gcc.target/arm/thumb-ifcvt-2.c'
when ran for an Armv8.1-M Mainline target.

This patch implements the target hook TARGET_NOCE_CONVERSION_PROFITABLE_P to
only allow "noce" to generate patterns that match CSINV, CSINC and CSNEG.  Thus
ensuring that the early "ce" passes do not ruin things for later ones.

gcc/ChangeLog:

PR target/116444
* config/arm/arm-protos.h (arm_noce_conversion_profitable_p): New
declaration.
* config/arm/arm.cc (arm_is_v81m_cond_insn): New helper function used
in ...
(arm_noce_conversion_profitable_p): ... here. New function to implement
...
(TARGET_NOCE_PROFITABLE_P): ... this target hook.  New define.
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.cc