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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sa...@gcc.gnu.org>:

https://gcc.gnu.org/g:2a12adfa8bd61e46538ebd97ae927d594843026a

commit r13-856-g2a12adfa8bd61e46538ebd97ae927d594843026a
Author: Roger Sayle <ro...@nextmovesoftware.com>
Date:   Mon May 30 21:23:15 2022 +0100

    Make the default rtx_costs of MULT/DIV variants consistent.

    GCC's middle-end provides a default cost model for RTL expressions, for
    backends that don't specify their own instruction timings, that can be
    summarized as multiplications are COSTS_N_INSNS(4), divisions are
    COSTS_N_INSNS(7) and all other operations are COSTS_N_INSNS(1).
    This patch tweaks the above definition so that fused-multiply-add
    (FMA) and high-part multiplications cost the same as regular
multiplications,
    or more importantly aren't (by default) considered less expensive. 
Likewise
    the saturating forms of multiplication and division cost the same as the
    regular variants.  These values can always be changed by the target, but
    the goal is to avoid RTL expansion substituting a suitable operation with
    its saturating equivalent because it (accidentally) looks much cheaper.
    For example, PR 89845 is about implementing division/modulus via highpart
    multiply, which may accidentally look extremely cheap.

    2022-05-30  Roger Sayle  <ro...@nextmovesoftware.com>

    gcc/ChangeLog
            * rtlanal.cc (rtx_cost) <MULT>: Treat FMA, SS_MULT, US_MULT,
            SMUL_HIGHPART and UMUL_HIGHPART as having the same cost as MULT.
            <DIV>: Likewise, SS_DIV and US_DIV have the same default as DIV.

Reply via email to