summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/Disassembler
diff options
context:
space:
mode:
authorGabor Buella <gabor.buella@intel.com>2018-04-20 18:42:47 +0000
committerGabor Buella <gabor.buella@intel.com>2018-04-20 18:42:47 +0000
commit31fa8025ba5143cdb2804e637dd5f3e3cd2e1c26 (patch)
treed0e705effe28d87ac92e45b03d56ec179279fb2f /llvm/lib/Target/X86/Disassembler
parent041eb6fef6ac824f5a903be971067b269fcead1f (diff)
downloadbcm5719-llvm-31fa8025ba5143cdb2804e637dd5f3e3cd2e1c26.tar.gz
bcm5719-llvm-31fa8025ba5143cdb2804e637dd5f3e3cd2e1c26.zip
[X86] WaitPKG instructions
Three new instructions: umonitor - Sets up a linear address range to be monitored by hardware and activates the monitor. The address range should be a writeback memory caching type. umwait - A hint that allows the processor to stop instruction execution and enter an implementation-dependent optimized state until occurrence of a class of events. tpause - Directs the processor to enter an implementation-dependent optimized state until the TSC reaches the value in EDX:EAX. Also modifying the description of the mfence instruction, as the rep prefix (0xF3) was allowed before, which would conflict with umonitor during disassembly. Before: $ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble .text mfence After: $ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble .text umonitor %rax Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45253 llvm-svn: 330462
Diffstat (limited to 'llvm/lib/Target/X86/Disassembler')
-rw-r--r--llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
index 9625ebfd7aa..41c66646884 100644
--- a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
+++ b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
@@ -965,8 +965,6 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) {
break;
}
- if (insn->hasAdSize)
- attrMask |= ATTR_ADSIZE;
}
if (insn->rexPrefix & 0x08) {
@@ -1059,13 +1057,14 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) {
}
/*
- * Absolute moves need special handling.
+ * Absolute moves and umonitor need special handling.
* -For 16-bit mode because the meaning of the AdSize and OpSize prefixes are
* inverted w.r.t.
* -For 32-bit mode we need to ensure the ADSIZE prefix is observed in
* any position.
*/
- if (insn->opcodeType == ONEBYTE && ((insn->opcode & 0xFC) == 0xA0)) {
+ if ((insn->opcodeType == ONEBYTE && ((insn->opcode & 0xFC) == 0xA0)) ||
+ (insn->opcodeType == TWOBYTE && (insn->opcode == 0xAE))) {
/* Make sure we observed the prefixes in any position. */
if (insn->hasAdSize)
attrMask |= ATTR_ADSIZE;
@@ -1073,8 +1072,12 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) {
attrMask |= ATTR_OPSIZE;
/* In 16-bit, invert the attributes. */
- if (insn->mode == MODE_16BIT)
- attrMask ^= ATTR_ADSIZE | ATTR_OPSIZE;
+ if (insn->mode == MODE_16BIT) {
+ attrMask ^= ATTR_ADSIZE;
+ /* The OpSize attribute is only valid with the absolute moves. */
+ if (insn->opcodeType == ONEBYTE && ((insn->opcode & 0xFC) == 0xA0))
+ attrMask ^= ATTR_OPSIZE;
+ }
if (getIDWithAttrMask(&instructionID, insn, attrMask))
return -1;
OpenPOWER on IntegriCloud