llvm.org GIT mirror llvm / 6b95374
[X86][Disassembler] Make sure EVEX.X is not used to extend base registers of memory operations. This was an accidental side effect of EVEX.X being used to encode XMM16-XMM31 using modrm.rm with modrm.mod==0x3. I think there are still more bugs related to this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333722 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 2 years ago
2 changed file(s) with 9 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
13031303 * @return - 0 if the information was successfully read; nonzero otherwise.
13041304 */
13051305 static int readModRM(struct InternalInstruction* insn) {
1306 uint8_t mod, rm, reg;
1306 uint8_t mod, rm, reg, evexrm;
13071307
13081308 dbgprintf(insn, "readModRM()");
13091309
13401340
13411341 reg |= rFromREX(insn->rexPrefix) << 3;
13421342 rm |= bFromREX(insn->rexPrefix) << 3;
1343
1344 evexrm = 0;
13431345 if (insn->vectorExtensionType == TYPE_EVEX && insn->mode == MODE_64BIT) {
13441346 reg |= r2FromEVEX2of4(insn->vectorExtensionPrefix[1]) << 4;
1345 rm |= xFromEVEX2of4(insn->vectorExtensionPrefix[1]) << 4;
1347 evexrm = xFromEVEX2of4(insn->vectorExtensionPrefix[1]) << 4;
13461348 }
13471349
13481350 insn->reg = (Reg)(insn->regBase + reg);
14321434 break;
14331435 case 0x3:
14341436 insn->eaDisplacement = EA_DISP_NONE;
1435 insn->eaBase = (EABase)(insn->eaRegBase + rm);
1437 insn->eaBase = (EABase)(insn->eaRegBase + rm + evexrm);
14361438 break;
14371439 }
14381440 break;
575575
576576 #CHECK: enclv
577577 0x0f 0x01 0xc0
578
579 # Make sure we ignore EVEX.X when the index register isn't being used.
580 #CHECK: vaddps (%rax), %xmm16, %xmm1
581 0x62 0xb1 0x7c 0x00 0x58 0x08