This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 fused multiply-add patch [+ patchlet]
- From: Segher Boessenkool <segher at koffie dot nl>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 04 Jan 2003 01:51:45 +0100
- Subject: Re: rs6000 fused multiply-add patch [+ patchlet]
- References: <3E111A25.816F2D1E@koffie.nl> <200212310451.XAA23960@makai.watson.ibm.com> <3E138D45.7F5A0EC0@koffie.nl> <jmn0mkjpgc.fsf@desire.geoffk.org>
Geoff Keating wrote:
>
> 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.
Here are some of the cases that happen most on PowerPC:
-- comparing an SI to a "big" constant.
(set (reg2) (big_constant))
(set:CC (compare:CC (reg1) (reg2)))
becomes
(set (reg1) (xor (reg1) (hi_constant)))
(set:CC (compare:CC (reg1) (lo_constant)))
There is a define_split to handle this; it splits two rtl insns
into two different rtl insns. In actual machine insns this is
an improvement, though (either less insns, or less register
pressure if lo == 0). So you're saying there should be a define_insn
for this too, so combine would think this is just one insn?
-- sign extend of xor (twice) => xor (twice) of sign extend.
Swapping an xor with a sign extend doesn't help per se, but it
does in cases like this. combine can't help it: it would need
to look at 4 insns.
> 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.
Small progress is progress too. Of course there's more to be gained
by writing a new'n'improved combine pass, or a new separate pass, but
that's not a reason to not accept other improvements. All IMHO of course,
and assuming it is actually an improvement :)
Segher