You've unfortunately chosen a complex example.<br><br>Your second question is needs be answered first. null_frag causes the pattern to be dropped.<br><br>Now having covered that the reason the operands are in the order they are is because the only instruction that doesn't use null_frag is this one<br>
<br>defm r213 : fma3s_rm<opc213, !strconcat(OpStr, !strconcat("213", PackTy)),<br>                     x86memop, RC, OpVT, mem_frag, OpNode><br><br>Which specifies the operand order as 213 thus why they are 2, 1, 3 in the pattern.<br>
<br>~Craig<br><br><div class="gmail_quote">On Fri, Nov 16, 2012 at 12:19 AM, Anitha B Gollamudi <span dir="ltr"><<a href="mailto:anitha.boyapati@gmail.com" target="_blank">anitha.boyapati@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 16 November 2012 13:41, Anitha B Gollamudi <<a href="mailto:anitha.boyapati@gmail.com">anitha.boyapati@gmail.com</a>> wrote:<br>

> Hi,<br>
><br>
> I have a simple question w.r.t the order of operands used in dag<br>
> pattern matching in target files. Some of them seem intuitive. But I<br>
> want to get it clarified anyway. I am using a pattern from<br>
> X86InstrFMA.td in the below example. Consider FMA3 pattern<br>
> (simplified).<br>
><br>
> let Constraints = "$src1 = $dst" in {<br>
> multiclass fma3s_rm<bits<8> opc, string OpcodeStr, X86MemOperand x86memop,<br>
>                     RegisterClass RC, ValueType OpVT, PatFrag mem_frag,<br>
>                     SDPatternOperator OpNode = null_frag> {<br>
><br>
>   def r     : FMA3<opc, MRMSrcReg, (outs RC:$dst),<br>
>                    (ins RC:$src1, RC:$src2, RC:$src3),<br>
>                    !strconcat(OpcodeStr,<br>
>                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),<br>
>                    [(set RC:$dst,<br>
>                      (OpVT (OpNode RC:$src2, RC:$src1, RC:$src3)))]>;<br>
><br>
><br>
> Given that it is an FMA pattern, the OpNode can be one of X86Fmadd,<br>
> X86Fmsub (among other opnodes). The respective operations are :<br>
> (a*b+c) and (a*b-c). My questions are:<br>
><br>
> 1. Why does $src2 and not $src1 come first in (OpNode RC:$src2,<br>
> RC:$src1, RC:$src3) ?  In other words what is the difference between<br>
> (a) and (b):<br>
>    (a)    [(set RC:$dst, (OpVT (OpNode RC:$src2, RC:$src1, RC:$src3)))]<br>
>    (b)    [(set RC:$dst,(OpVT (OpNode RC:$src1, RC:$src2, RC:$src3)))]<br>
><br>
<br>
</div></div>Typo.<br>
<div class="im"><br>
> 2. Why happens when OpNode is null_frag?<br>
<br>
</div>2. What happens when OpNode is null_frag?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
--<br>
 Anitha<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>~Craig<br>