From: Elena Demikhovsky Date: Wed, 5 Feb 2014 13:03:01 +0000 (+0000) Subject: AVX-512: fixed a bug in EVEX encoding (the bug appeared after r200624) X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1ee5ca7005d8f091854fee154422320a271a4d6c;p=oota-llvm.git AVX-512: fixed a bug in EVEX encoding (the bug appeared after r200624) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200837 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp index 3d4bbafee66..a76eecaaee6 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -184,7 +184,7 @@ static bool isDisp8(int Value) { /// isCDisp8 - Return true if this signed displacement fits in a 8-bit /// compressed dispacement field. static bool isCDisp8(uint64_t TSFlags, int Value, int& CValue) { - assert(((TSFlags >> X86II::VEXShift) & X86II::EVEX) && + assert((TSFlags & X86II::EncodingMask) >> X86II::EncodingShift == X86II::EVEX && "Compressed 8-bit displacement is only valid for EVEX inst."); unsigned CD8E = (TSFlags >> X86II::EVEX_CD8EShift) & X86II::EVEX_CD8EMask; @@ -386,7 +386,9 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op, const MCOperand &Scale = MI.getOperand(Op+X86::AddrScaleAmt); const MCOperand &IndexReg = MI.getOperand(Op+X86::AddrIndexReg); unsigned BaseReg = Base.getReg(); - bool HasEVEX = (TSFlags >> X86II::VEXShift) & X86II::EVEX; + unsigned char Encoding = (TSFlags & X86II::EncodingMask) >> + X86II::EncodingShift; + bool HasEVEX = (Encoding == X86II::EVEX); // Handle %rip relative addressing. if (BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode diff --git a/test/MC/X86/avx512-encodings.s b/test/MC/X86/avx512-encodings.s index 38f9190d949..b2f1d11e081 100644 --- a/test/MC/X86/avx512-encodings.s +++ b/test/MC/X86/avx512-encodings.s @@ -43,3 +43,7 @@ vpbroadcastd %xmm0, %zmm1 {%k1} {z} // CHECK: vmovdqu64 {{.*}} {%k3} // CHECK: encoding: [0x62,0xf1,0xfe,0x4b,0x6f,0xc8] vmovdqu64 %zmm0, %zmm1 {%k3} + +// CHECK: vmovd +// CHECK: encoding: [0x62,0xe1,0x7d,0x08,0x7e,0xb4,0x24,0xac,0xff,0xff,0xff] +vmovd %xmm22, -84(%rsp) \ No newline at end of file