From: Jan Sjödin Date: Thu, 8 Dec 2011 14:43:19 +0000 (+0000) Subject: Src2 and src3 were accidentally swapped for the FMA4 rr patterns. Undo this and fix... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=703420f50e458e2482e55c9a5b3cafa0b734f507;p=oota-llvm.git Src2 and src3 were accidentally swapped for the FMA4 rr patterns. Undo this and fix the encoding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146151 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp index dbd52078d80..0c00f11be26 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -973,13 +973,14 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, if (HasVEX_4V) // Skip 1st src (which is encoded in VEX_VVVV) SrcRegNum++; - // GAS sets the XOP_W even with register operands, we want to match this. - // XOP_W is ignored, so there is no swapping of the operands - XOP_W_I8IMMOperand = 3; + if(HasXOP_W) // Skip 2nd src (which is encoded in I8IMM) + SrcRegNum++; EmitRegModRMByte(MI.getOperand(SrcRegNum), GetX86RegNum(MI.getOperand(CurOp)), CurByte, OS); - CurOp = SrcRegNum + 1; + + // 2 operands skipped with HasXOP_W, comensate accordingly + CurOp = HasXOP_W ? SrcRegNum : SrcRegNum + 1; if (HasVEX_4VOp3) ++CurOp; break; @@ -998,13 +999,9 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, EmitMemModRMByte(MI, FirstMemOp, GetX86RegNum(MI.getOperand(CurOp)), TSFlags, CurByte, OS, Fixups); - if(HasXOP_W) { - CurOp = NumOps - 1; // We have consumed all except one operand (third) - } else { - CurOp += AddrOperands + 1; - if (HasVEX_4VOp3) - ++CurOp; - } + CurOp += AddrOperands + 1; + if (HasVEX_4VOp3) + ++CurOp; break; } diff --git a/lib/Target/X86/X86InstrFMA.td b/lib/Target/X86/X86InstrFMA.td index 015b01ecffd..f4430887a1f 100644 --- a/lib/Target/X86/X86InstrFMA.td +++ b/lib/Target/X86/X86InstrFMA.td @@ -68,7 +68,7 @@ multiclass fma4s opc, string OpcodeStr> { def rr : FMA4, XOP_W; def rm : FMA4 opc, string OpcodeStr> { def rr : FMA4, XOP_W; def rm : FMA4 opc, string OpcodeStr> { def rrY : FMA4, XOP_W; def rmY : FMA4