[PATCH] Check rtx_costs in combine.c's try_combine

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Mon Jun 28 18:29:00 GMT 2004


    >     cost metric.  Increasingly with modern processors, the more complex
    >     instructions supported are an ISA are not automatically better than

    Here's an example transformation that combine can do: it can recognize
    a zero-extract operation in any of several forms, including two shifts
    in opposite directions and a shift followed by an AND.  After
    canonicalizing the operation it tries to output it as shift-AND, and if
    that fails, outputs it as shift-shift - even if it was in some more
    efficient form to begin with and shifts are expensive.  Your response
    suggests that the md file should not have the expensive shift
    instructions.  That would pessimize the optimizers quite nastily.

But that's not the case above!  The original cases are insns which
are always slower than ones that they are composed of.  I don't see how
not including them in the MD file would pessimize the optimizers.

You example is a different one, where the insn choice need to be affected
by cost.  Indeed there's a hole there because the design of much of the
optimizers for RISC-type machines made the assumption that (except for
memory references and branches) all insns are of equal cost.



More information about the Gcc-patches mailing list