<div>
<p>Hi everyone,</p>
<p>I practice writing target description file with MSP430 reference. </p>
<p>I add a multiply-and-add instruction as below:</p>
<p>let isTwoAddress=1 in {</p>
<p> def MULADD:Pseudo<(out GR16:$dst), (ins GR16:$src1, GR16:$src2, GR16:$src3), </p>
<p> "muladd\t{$dst, $src2, $src3}",</p>
<p> [(set GR16:$dst, (add GR16:$src1, (mul GR16:$src2, GR16:$src3)))]></p>
<p>}</p>
<p>How can i tell the system X=A*B + C == X = B*A + C == X=C+A*B == X=C+B*A by property 'isCommutable'? Is it necessary to do that?</p>
<p>*** Another question: Why set isCommutable = 1 in ADD16rr but NOT set in ADD16ri?</p>
<p>let isCommutable = 1 in { // X = ADD Y, Z == X = ADD Z, Y<br>def ADD16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),<br> "add.w\t{$src2, $dst}",<br> [(set GR16:$dst, (add GR16:$src1, GR16:$src2)),<br>
(implicit SRW)]>;<br>}<br>def ADD16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),<br> "add.w\t{$src2, $dst}",<br> [(set GR16:$dst, (add GR16:$src1, imm:$src2)),<br>
(implicit SRW)]>;</p>
<p>Regards</p></div>