On 6/3/24 5:34 AM, Manolis Tsamis wrote:
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.

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.

Signed-off-by: Manolis Tsamis <manolis.tsa...@vrull.eu>
---

Changes in v4:
         - Remove unnecessary hardcoded list of allowed ops in
         bb_ok_for_noce_convert_multiple_sets.
         - Set need_cmov based on BB live_out instead of REG_DEAD notes.
         - Fix preexisting issues and improve the code that sets 
read_comparison.
Do you need to avoid things like asms? Or are those rejected elsewhere? From a diff standpoint it seems quite sensible, but boy just removing all the guardrails makes me nervous.

So assuming asms are rejected somewhere else and this has been through a bootstrap and regression test, this is OK for the trunk.

jeff

Reply via email to