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

Daniel Jacobowitz drow@false.org
Mon Jun 28 15:25:00 GMT 2004


On Mon, Jun 28, 2004 at 07:20:38AM -0400, Richard Kenner wrote:
>     The following patch adds an additional test to combine.c's try_combine
>     to only allow instructions to be merged/combined if the backend's
>     TARGET_RTX_COST macro indictates that the replacement is atleast as
>     cheap as the original.  Historically, GCC's "combine" pass has used
>     a greedy algorithm that always attempts to build complex composite
>     instructions that are recognized by the back-end independent of any
>     cost metric.  Increasingly with modern processors, the more complex
>     instructions supported are an ISA are not automatically better than
>     their component parts.
> 
> Yes, but in such a case, those complex instructions should not in the MD
> file as there is no situation in which they should be used.
> 
> I disagree with this patch.

Huh?

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.

-- 
Daniel Jacobowitz



More information about the Gcc-patches mailing list