[llvm-commits] [llvm] r163035 - in /llvm/trunk: lib/Target/X86/X86InstrFMA.td lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/fma_patterns.ll

Craig Topper craig.topper at gmail.com
Tue Sep 4 12:20:01 PDT 2012


The default implementation of findCommutedOpIndices returns the first two
input operands which works for these instructions. We also have precedent
in the commuting of SHRD and SHLD instructions which have a third immediate
argument. They have partial custom code, but don't change from the default
implementation of findCommutedOpIndices.

I made them commutable so that TwoAddressInstructionPass and
optimizeLoadInstr can better optimize them.

We can still do better here because there are 3 different FMA3 opcodes that
vary which operand is the destructive dest and where the load can be
folded. Not sure the best way to work some of that into the infrastructure
without creating a new pass. I'd appreciate any input you have on that.

~Craig

On Tue, Sep 4, 2012 at 10:32 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

>
> On Aug 31, 2012, at 4:10 PM, Craig Topper <craig.topper at gmail.com> wrote:
>
> > Author: ctopper
> > Date: Fri Aug 31 18:10:34 2012
> > New Revision: 163035
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=163035&view=rev
> > Log:
> > Mark FMA4 instructions as commutable and add them to the folding tables.
> >
>
> > multiclass fma4s<bits<8> opc, string OpcodeStr, RegisterClass RC,
> >                  X86MemOperand x86memop, ValueType OpVT, SDNode OpNode,
> >                  PatFrag mem_frag> {
> > +  let isCommutable = 1 in
> >   def rr : FMA4<opc, MRMSrcReg, (outs RC:$dst),
> >            (ins RC:$src1, RC:$src2, RC:$src3),
> >            !strconcat(OpcodeStr,
>
> Hi Craig,
>
> I am not sure it is safe to mark 3-input instructions as commutable. See
> TargetInstrInfoImpl::findCommutedOpIndices().
>
> Why do you need to do that?
>
> /jakob
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120904/9a9592f3/attachment.html>


More information about the llvm-commits mailing list