https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120372

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:21a487046f4acda0d7d3aaed08a99501bd0430d3

commit r16-822-g21a487046f4acda0d7d3aaed08a99501bd0430d3
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue May 20 14:48:58 2025 -0700

    expand: Use rtx_cost directly instead of gen_move_insn for
canonicalize_comparison.

    This is the first part in fixing PR target/120372.
    The current code for canonicalize_comparison, uses gen_move_insn and
rtx_cost to find
    out the cost of generating a constant. This is ok in most cases except
sometimes
    the comparison instruction can handle different constants than a simple set
    intruction can do. This changes to use rtx_cost directly with the outer
being COMPARE
    just like how prepare_cmp_insn handles that.

    Note this is also a small speedup and small memory improvement because we
are not creating
    a move for the constant any more. Since we are not creating a
psedu-register any more, this
    also removes the check on that.

    Also adds a dump so we can see why one choice was chosen over the other.

    Build and tested for aarch64-linux-gnu.

    gcc/ChangeLog:

            * expmed.cc (canonicalize_comparison): Use rtx_cost directly
            instead of gen_move_insn. Print out the choice if dump is enabled.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to