rs6000 fused multiply-add patch [+ patchlet]

Geoff Keating geoffk@geoffk.org
Thu Jan 2 01:44:00 GMT 2003


Segher Boessenkool <segher@koffie.nl> writes:

> David Edelsohn wrote:
> > 
> >         The combine pass is called "combine" because it is predicated on
> > combining instructions and uses decreased instructions as the goal.
> 
> Yes, I understand that.
> 
> > If more optimal instruction sequences should be used, that needs to be
> > optimized by a different pass.  Your bitfield+mfcr -> logic instruction
> > example might be appropriate as define_peephole2 patterns.  Your load+mask
> > -> narrower load already should be handled correctly by other
> > optimizations or the combiner because it seem like it should decrease the
> > number of instructions.
> 
> Well, all these optimizations are already there, in simplify-rtx.c etc., it's
> just that they never get done by the current combine, because it doesn't
> decrease the number of rtl insns _if looking through a very small (3 insn)
> window_.

What you usually do in this case is create a combination insn+splitter
to give combine an appropriate intermediate result.

If you could provide testcases/code samples for the cases you mention,
it would be easier to see precisely what's going on.  Often several
iterations and many eyes are necessary to get the proper fix.

It is also possible that some rearchitecting of combine might be
necessary, but that's something that would require careful
consideration and an examination of all the possible alternatives,
not an ad-hoc patch to solve a specific problem.

> > If the code size is decreasing then the number of
> > instructions is decreasing, so maybe we need to add patterns transforming
> > three instructions into two instructions.
> 
> That's a lot of different patterns; also, it's not only 3->2, but also 4->3
> and I saw an 8->7, even.

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-patches mailing list