]> git.ipfire.org Git - thirdparty/gcc.git/commit
ifcvt: Allow more operations in multiple set if conversion
authorManolis Tsamis <manolis.tsamis@vrull.eu>
Fri, 30 Jun 2023 12:05:15 +0000 (14:05 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Mon, 12 Aug 2024 12:57:22 +0000 (14:57 +0200)
commit72c9b5f438f22cca493b4e2a8a2a31ff61bf1477
tree40b60889b13b3f649286df11368ec39723cf0dbe
parent28b3812c9d81203ae3d6a5350d8f828f4e659e50
ifcvt: Allow more operations in multiple set if conversion

Currently the operations allowed for if conversion of a basic block
with multiple sets are few, namely REG, SUBREG and CONST_INT (as
controlled by bb_ok_for_noce_convert_multiple_sets).

This commit allows more operations (arithmetic, compare, etc) to
participate in if conversion. The target's profitability hook and
ifcvt's costing is expected to reject sequences that are unprofitable.

This is especially useful for targets which provide a rich selection
of conditional instructions (like aarch64 which has cinc, csneg,
csinv, ccmp, ...)  which are currently not used in basic blocks with
more than a single set.

For targets that have a rich selection of conditional instructions,
like aarch64, we have seen an ~5x increase of profitable if
conversions for multiple set blocks in SPEC CPU 2017 benchmarks.

gcc/ChangeLog:

* ifcvt.cc (try_emit_cmove_seq): Modify comments.
(noce_convert_multiple_sets_1): Modify comments.
(bb_ok_for_noce_convert_multiple_sets): Allow more operations.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/ifcvt_multiple_sets_arithm.c: New test.
gcc/ifcvt.cc
gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_arithm.c [new file with mode: 0644]