[LLVMdev] MFENCE encoding

Mon Ping Wang wangmp at apple.com
Thu Oct 16 22:46:42 PDT 2008


Hi,

I have a problem with creating a MFENCE on X86 with SSE

In X86InstrSSE.td, a MFENCE is
def MFENCE : I<0xAE, MRM6m, (outs), (ins),
               "mfence", [(int_x86_sse2_mfence)]>, TB, Requires< 
[HasSSE2]>;

In X86CodeEmitter.cpp in emitInstruction

  case X86II::MRM6m: case X86II::MRM7m: {
    intptr_t PCAdj = (CurOp+4 != NumOps) ?
      (MI.getOperand(CurOp+4).isImm() ? X86InstrInfo::sizeOfImm 
(Desc) : 4) : 0;
    ...

If I'm reading the code correctly, the NumOps is 0 and CurOp is 0 so  
we to get the 4th operand from the MFENCE operation which has no  
operands so we get an error.  I'm not sure what this code is trying to  
do.  Should the condition be < NumOps?

Thanks,
  -- Mon Ping



More information about the llvm-dev mailing list