>>Note that the isCommutable flag is only really useful for two-address
instructions. If the two inputs are not constrained, nothing is really
won by swapping them.<br>Ahh i see, good to know that.<br><br>>> Does the -view-*-dags output look correct?<br>They do look correct, there are three Xmul_lohi blocks, one returns the low part copied into R14 and the rest of combinations get added and merged into R15.<br>
<br>Here is my selectionDAG code, i used X86's MUL code and adapted it to my target:<br><br> case ISD::SMUL_LOHI:<br> case ISD::UMUL_LOHI:<br> {<br> SDValue Op1 = N->getOperand(0);<br> SDValue Op2 = N->getOperand(1);<br>
unsigned LoReg = R0, HiReg = R1;<br> unsigned Opc = MULRdRr;<br><br> SDValue InFlag = SDValue(CurDAG->getMachineNode(Opc,<br> dl,<br>
MVT::Flag,<br> Op1,<br> Op2), 0);<br><br> // Copy the low half of the result, if it is needed.<br>
if (!SDValue(N, 0).use_empty())<br> {<br> SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),<br> dl,<br> LoReg,<br>
NVT,<br> InFlag);<br> InFlag = Result.getValue(2);<br> ReplaceUses(SDValue(N, 0), Result);<br>
}<br><br> // Copy the high half of the result, if it is needed.<br> if (!SDValue(N, 1).use_empty())<br> {<br> SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),<br>
dl,<br> HiReg,<br> NVT,<br> InFlag);<br>
InFlag = Result.getValue(2);<br> ReplaceUses(SDValue(N, 1), Result);<br> }<br><br> return NULL;<br> }<br><br>ISD::MUL is set to be expanded.<br>