I don't think changing to VEX_4VOp3 to VEX_4V is the right fix. I think 
the fix is to increment CurOp twice at the start for these instructions 
so that only the input operands are used for encoding.<br><br>Also, I just submitted a patch to revert the operand order for these instructions in the assembler/disassembler. Destination register should appear on the right and the mask should appear on the left as we use AT&T syntax by default. It will probably conflict with your updates here.<br>
<br><div class="gmail_quote">On Mon, Jul 9, 2012 at 11:24 PM, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Yes, there is an easy way to fix this.<br>
MRMSrcMem assumes register, memory, vvvv register if VEX_4VOp3 is true and assumes register, vvvv register, memory if VEX_4V is true.<br>
<br>
I just need to change the flag from VEX_4VOp3 to VEX_4V. There are a few places where we assume only the 2nd operand can be tied-to:<br>
Desc->getOperandConstraint(1, MCOI::TIED_TO) != -1 (hard-coded index 1)<br>
I will fix those to handle this instruction.<br>
<br>
Thanks,<br>
Manman<br>
<div><div><br>
On Jul 9, 2012, at 10:07 PM, Evan Cheng wrote:<br>
<br>
><br>
><br>
> On Jul 9, 2012, at 4:15 PM, Manman Ren <<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>> wrote:<br>
><br>
>><br>
>> I need to implement an instruction which has 2 read-write registers, so I added<br>
>> let Constraints = "$src1 = $dst, $mask = $mask_wb" in {<br>
>> ...<br>
>> def rm  : AVX28I<opc, MRMSrcMem, (outs VR128:$dst, VR128:$mask_wb),<br>
>>           (ins VR128:$src1, v128mem:$src2, VR128:$mask),<br>
>> ...<br>
>> }<br>
>> There is a problem since MRMSrcMem assumes the 2nd physical operand is a memory operand.<br>
>> See the section about MRMSrcMem in RecognizableInstr::emitInstructionSpecifier.<br>
><br>
> Can this be fixed?<br>
><br>
> Evan<br>
><br>
>> And the above gives us $dst, $mask_wb, $src1, $mem, $mask, and $mask_wb is the second physical operand.<br>
>><br>
>> I thought about using "$mask_wb = $mask", but it breaks the assumption of TIED_TO LhsIdx > RhsIdx.<br>
>> Is adding another addressing mode a good idea?<br>
>><br>
>> Any pointer is appreciated.<br>
>> Thanks,<br>
>> Manman<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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>